- Ishan.Arora
- NEWBIE
- 170 Points
- Member since 2017
- Salesfroce Developer
- Metacube
-
ChatterFeed
-
1Best Answers
-
4Likes Received
-
2Likes Given
-
2Questions
-
11Replies
How to open a add new record page when a custom button is click
Hi,
I have a visualforce page with a button 'RCA' and when I click this I need to open a add new record screen for an object 'RCA__c', is it possible, please help
I have a visualforce page with a button 'RCA' and when I click this I need to open a add new record screen for an object 'RCA__c', is it possible, please help
- mw6
- July 21, 2017
- Like
- 0
- Continue reading or reply
Fetch Apex Message in text Class from Vf page
i want to test a contoller class using Apex Message passed by the controller on the Vf page
But i am not able to get any result as pageMessages comes null
Any ideas how i can do it ?
static testMethod void test_Member(){ //start the test process Test.startTest(); Test.setCurrentPage(Page.BankManagement_Login); TransactionController obj = new TransactionController(); ApexPages.Message[] pageMessages = ApexPages.getMessages(); //List<Apexpages.Message> pageMessages = ApexPages.getMessages(); Boolean check=false; obj.username='aneesh@gmail.com'; obj.password='12'; obj.login(); System.debug('hello1'); for(ApexPages.Message msg:pageMessages){ if (msg.getDetail().contains('Username Or Password is not valid')) { check = true; }else{ check = false; } } system.assert(check); //Stop the test process Test.stopTest(); }
- Ishan.Arora
- July 21, 2017
- Like
- 2
- Continue reading or reply
i want to insert record xls file using email handler. Any ideas?
i want to insert record xls file using email handler. Any ideas?
- Ishan.Arora
- July 20, 2017
- Like
- 2
- Continue reading or reply
Fetch Apex Message in text Class from Vf page
i want to test a contoller class using Apex Message passed by the controller on the Vf page
But i am not able to get any result as pageMessages comes null
Any ideas how i can do it ?
static testMethod void test_Member(){ //start the test process Test.startTest(); Test.setCurrentPage(Page.BankManagement_Login); TransactionController obj = new TransactionController(); ApexPages.Message[] pageMessages = ApexPages.getMessages(); //List<Apexpages.Message> pageMessages = ApexPages.getMessages(); Boolean check=false; obj.username='aneesh@gmail.com'; obj.password='12'; obj.login(); System.debug('hello1'); for(ApexPages.Message msg:pageMessages){ if (msg.getDetail().contains('Username Or Password is not valid')) { check = true; }else{ check = false; } } system.assert(check); //Stop the test process Test.stopTest(); }
- Ishan.Arora
- July 21, 2017
- Like
- 2
- Continue reading or reply
i want to insert record xls file using email handler. Any ideas?
i want to insert record xls file using email handler. Any ideas?
- Ishan.Arora
- July 20, 2017
- Like
- 2
- Continue reading or reply
pass a variable in a new window url
I have a variable 'd' that captures the current date time.
In the same page i have a button inside jquery which is redirecting to a new page in new window.
I want to pass the variable d in the url.
Code:
var d = new Date();
The url is : '<a href="/apex/vfp_KOT?oid=" class="js-newWindow" data-popup="width=500,height=600"><button type="button" class="btn btn-primary">Print KOT</button></a> '+
New Window :
$(document).ready(function(){
$('.js-newWindow').click(function (event) {
event.preventDefault();
var $this = $(this);
var url = $this.attr("href");
var windowName = "popUp";
var windowSize = $this.data("popup");
//alert($.session.get('sessionoid'));
var noid = $.session.get('sessionoid');
var urlnew = url+noid;
window.open(urlnew, windowName, windowSize);
});
});
In the same page i have a button inside jquery which is redirecting to a new page in new window.
I want to pass the variable d in the url.
Code:
var d = new Date();
The url is : '<a href="/apex/vfp_KOT?oid=" class="js-newWindow" data-popup="width=500,height=600"><button type="button" class="btn btn-primary">Print KOT</button></a> '+
New Window :
$(document).ready(function(){
$('.js-newWindow').click(function (event) {
event.preventDefault();
var $this = $(this);
var url = $this.attr("href");
var windowName = "popUp";
var windowSize = $this.data("popup");
//alert($.session.get('sessionoid'));
var noid = $.session.get('sessionoid');
var urlnew = url+noid;
window.open(urlnew, windowName, windowSize);
});
});
- PC
- August 09, 2017
- Like
- 0
- Continue reading or reply
Help please. I cannot complete a trailhead hands on challenge. Admin Intermediate, Formulas & Validations, Create Validation Rules
I am having trouble completing the Hands On Challenge in Trailhead. It is in Admin Intermediate Trail, Section Formulas & Validations, Create Validation Rules Section. The instructions are below. Can someone please help? I have been stuck on this for a while now. I cannot seem to get the validation formula correct.
Create a validation rule to check that a contact is in the zip code of its account.
To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).
Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)
Create a validation rule to check that a contact is in the zip code of its account.
To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).
Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)
- Todd Allmond
- August 08, 2017
- Like
- 0
- Continue reading or reply
How to write test class for this apex class and can anyone explain the trick to write test class
Apex class:
public class multiAddCEx {
public multiAddCEx(ApexPages.StandardSetController controller) {
}
public multiAddCEx(ApexPages.StandardController controller) {
}
List <Expense_Line_Item__c> CExList;
public Id cID = ApexPages.currentPage().getParameters().get('Id');
public Id getID {get; set;}
public PageReference reset() {
CExList = [select name, Expense__c, Expense_Head__c, Amount__c, Date__c, Sub_Expense__c, Payment_Type__c, Cost_Head__c from Expense_Line_Item__c where Expense__c =: cID order by createddate limit 15 ];
return null; }
public List <Expense_Line_Item__c> getCExs() {
if(CExList == null) reset();
return CExList;}
public void setAccounts(List <Expense_Line_Item__c> cexs) {
CExList = cexs;}
public PageReference save() {
upsert CExList;
ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.Info, 'Records Saved Successfully');
return null;}
public PageReference add() {
CExList.add(New Expense_Line_Item__c(Expense__c= cID));
return null; }
}
public class multiAddCEx {
public multiAddCEx(ApexPages.StandardSetController controller) {
}
public multiAddCEx(ApexPages.StandardController controller) {
}
List <Expense_Line_Item__c> CExList;
public Id cID = ApexPages.currentPage().getParameters().get('Id');
public Id getID {get; set;}
public PageReference reset() {
CExList = [select name, Expense__c, Expense_Head__c, Amount__c, Date__c, Sub_Expense__c, Payment_Type__c, Cost_Head__c from Expense_Line_Item__c where Expense__c =: cID order by createddate limit 15 ];
return null; }
public List <Expense_Line_Item__c> getCExs() {
if(CExList == null) reset();
return CExList;}
public void setAccounts(List <Expense_Line_Item__c> cexs) {
CExList = cexs;}
public PageReference save() {
upsert CExList;
ApexPages.Message myMsg = new ApexPages.message(ApexPages.Severity.Info, 'Records Saved Successfully');
return null;}
public PageReference add() {
CExList.add(New Expense_Line_Item__c(Expense__c= cID));
return null; }
}
- swain 10
- July 27, 2017
- Like
- 0
- Continue reading or reply
Lookup field not visible
Hello,
I have an issue on a lookup (with a field filter) field visibility on a profile. I checked multiple times, the field security level is correct, the profile can see the field and the custom object where the informations are stored.
Can you help me ?
Thanks,
I have an issue on a lookup (with a field filter) field visibility on a profile. I checked multiple times, the field security level is correct, the profile can see the field and the custom object where the informations are stored.
Can you help me ?
Thanks,
- Brandon COFFIN
- July 21, 2017
- Like
- 0
- Continue reading or reply
Fetch Apex Message in text Class from Vf page
i want to test a contoller class using Apex Message passed by the controller on the Vf page
But i am not able to get any result as pageMessages comes null
Any ideas how i can do it ?
static testMethod void test_Member(){ //start the test process Test.startTest(); Test.setCurrentPage(Page.BankManagement_Login); TransactionController obj = new TransactionController(); ApexPages.Message[] pageMessages = ApexPages.getMessages(); //List<Apexpages.Message> pageMessages = ApexPages.getMessages(); Boolean check=false; obj.username='aneesh@gmail.com'; obj.password='12'; obj.login(); System.debug('hello1'); for(ApexPages.Message msg:pageMessages){ if (msg.getDetail().contains('Username Or Password is not valid')) { check = true; }else{ check = false; } } system.assert(check); //Stop the test process Test.stopTest(); }
- Ishan.Arora
- July 21, 2017
- Like
- 2
- Continue reading or reply
How to open a add new record page when a custom button is click
Hi,
I have a visualforce page with a button 'RCA' and when I click this I need to open a add new record screen for an object 'RCA__c', is it possible, please help
I have a visualforce page with a button 'RCA' and when I click this I need to open a add new record screen for an object 'RCA__c', is it possible, please help
- mw6
- July 21, 2017
- Like
- 0
- Continue reading or reply
How to HyperLink on One of Fields in FieldSet used In PageBlockTable
<apex:pageBlockTable var="exp" value="{!listOfExpense}"> <apex:outputLink value="/{!exp.Id}" target="_blank">{!exp.Name}</apex:outputLink> <apex:repeat value="{!fieldSetMember}" var="fs"> <apex:column value="{!exp[fs]}" /> </apex:repeat> </apex:pageBlockTable>
- Ayush Gupta 14
- July 19, 2017
- Like
- 1
- Continue reading or reply
Unable to Access .isAccessible, .isCreateable, .isDeleteable or MetaData Field Details fields on VF page
I created a list of type
List< Schema.DescribeFieldResult> fieldDetail
It holds all field related detail to a Object and Use this list in pageBlockTable.
<apex:pageBlockTable value="{!fieldDetail}" var="od"> <apex:column value="{!od.Label}" headerValue="Label"/> <apex:column value="{!od.Name}" headerValue="API Name"/> <apex:column value="{!od.Type}" headerValue="Type"/> <apex:column value="{!od.Createable}" headerValue="isCreatable"/> </apex:pageBlockTable>
all three columns Label, Name, Type give show result, but when I add isCreatable column, It gives ERROR
Unknown property 'Schema.DescribeFieldResult.Createable'
Error is in expression '{!od.Createable}' in component <apex:column> in page objectdetail
Can anyone help to show this column on VF page.
I have an alternative of Wrapper class but I want show using upper Method.
List< Schema.DescribeFieldResult> fieldDetail
It holds all field related detail to a Object and Use this list in pageBlockTable.
<apex:pageBlockTable value="{!fieldDetail}" var="od"> <apex:column value="{!od.Label}" headerValue="Label"/> <apex:column value="{!od.Name}" headerValue="API Name"/> <apex:column value="{!od.Type}" headerValue="Type"/> <apex:column value="{!od.Createable}" headerValue="isCreatable"/> </apex:pageBlockTable>
all three columns Label, Name, Type give show result, but when I add isCreatable column, It gives ERROR
Unknown property 'Schema.DescribeFieldResult.Createable'
Error is in expression '{!od.Createable}' in component <apex:column> in page objectdetail
Can anyone help to show this column on VF page.
I have an alternative of Wrapper class but I want show using upper Method.
- pradeep kumar yadav
- July 19, 2017
- Like
- 1
- Continue reading or reply