You need to sign in to do that
Don't have an account?
How to Concatenate two strings based on Cirtain condition?
Hi everyone,
I have two objects Expense and Travel request and both are related by a lookup.
1.Travel Request has two fields like Travel_Purpose__c(Text Field) and Client_Visit__c(Look Up With Account).
2.Expense has two fields like Travel_Request__c(Look Up with Travel Request ) and Claim_Purpose__c(Text)
3.Now when i select Travel_Request__c then Claim_Purpose__c automatically in the same Editable page update like
If(Travel_Request__c != Null)
{
(Claim_Purpose__c= Travel_Purpose__c+Clent_Visit__c)
}
I have two objects Expense and Travel request and both are related by a lookup.
1.Travel Request has two fields like Travel_Purpose__c(Text Field) and Client_Visit__c(Look Up With Account).
2.Expense has two fields like Travel_Request__c(Look Up with Travel Request ) and Claim_Purpose__c(Text)
3.Now when i select Travel_Request__c then Claim_Purpose__c automatically in the same Editable page update like
If(Travel_Request__c != Null)
{
(Claim_Purpose__c= Travel_Purpose__c+Clent_Visit__c)
}
Please try with this code snippet,
Thanks and Regards,
Prosenjit Sarkar
I implement same, but still it is not working. Can you please check
public with sharing class DataPopulate {
public Travel_Request__c trq {get; set; }
private ApexPages.StandardController stdCtrl;
public DataPopulate(ApexPages.StandardController std)
{
stdCtrl = std;
}
public void doInsert() {
Expense__c exp = (Expense__c) stdCtrl.getRecord();
if (exp.Travel_Request__c == null) {
return;
} else {
trq = [select Name , Proposed_Client_to_Visit__c, Status__c from Travel_Request__c where Id = : exp.Travel_Request__c LIMIT 1];
System.debug('The record fetched '+trq);
exp.Claim_Purpose__c= trq.Name +''+ trq.Proposed_Client_to_Visit__c;
exp.Comments__c=trq.Status__c;
upsert exp;
System.debug('The record insert '+exp);
}
}
}