• sfdc dev 2264
  • NEWBIE
  • 170 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 59
    Questions
  • 79
    Replies
Hi All,

I have a requirement where when a case is created via third party site to salesforce the details in the case description doesnt get the special characters such as ($,&,@!) which is coming as a space and not carried over , but when created a case manually then the special characters are visible. Please let me know if there is any way to accomodate the special characters on case description when details comes via third party site.

Thanks in Advance
Hi ,

I have the following requirement for which i need help to acheive via apex class using custom metadata

1) I have a metadata which has few words in it 

ie:

test,ablility

2) i want to check if any of the keywords from the metadata are present in the case description (exact match along with the content) 
then change the case owner to a particular queue.


I need help on the same with the apex class


Thanks in Advance
 
Hi,

I have created a screen flow in new flow builder which would automatically create a new case , The flow is active and running fine.
I need to use it on Einstein Chat bot in my community.

Now when i am trying to use flow in bot builder, i am not finding the flow under action. It says "No Invocable Actions found".
Can someone tell me what is that i need to do additionally  so i can see the flow in bot builder?


User-added image
Hi,

I have a requirement where i am posting certain field information from my child object to parent object as a chatter post via apex which happens corretly

My issue is i have a auto number called recovery number which i want to make as a hyperlink when posted to chatter and when clicking on the same it should take me to the respective record. 

I have written the code but for some reasons its not working for me
public static void postToFeed(List<Recovery__c> recoveries , String status)
{
	for(Recovery__c rec : recoveries)
	{  
		String linkURL = '<a href="'+URL.getSalesforceBaseUrl().toExternalForm()+'/'+ rec.id+'" target="_blank">'+ rec.Name + '</a>';
        //String codeSnippet = '<html>\n\t<body>\n\t\tHello, world!\n\t</body>\n</html>';		
        String codeSnippet = '<html>\n';
			   codeSnippet += '\t<body>\n\t\t';
			   codeSnippet += 'Recovery Fulfillment ' + status +  ' for ' + rec.Type__c + '\n';
			   codeSnippet += 'Recovery Number: '+linkURL+ '\n';
			   codeSnippet += 'Recovery Value:' + ( rec.Value__c != null ? rec.Value__c : 0) + '\n';
			   codeSnippet += 'Feedback: ' + (String.isNotBlank(rec.Approver_Comment__c) ? rec.Approver_Comment__c : 'N/A') + '\n';
			   codeSnippet += 'Original Currency: ' + (String.isNotBlank(rec.Original_Currency__c) ? rec.Original_Currency__c : 'N/A') + '\n';
			   codeSnippet += '\t</body>\n</html>';

		ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
		input.subjectId = rec.Case_Number__c;
		input.feedElementType = ConnectApi.FeedElementType.FeedItem;

		ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
		ConnectApi.TextSegmentInput textSegment;

		messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();

		textSegment = new ConnectApi.TextSegmentInput();
		textSegment.text = codeSnippet;
		messageInput.messageSegments.add(textSegment);

		input.body = messageInput;

		ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), input);
	}
}

Kindly help me on the same and let me know the issue , Thanks in advance
Hi 

i have ave a Alex class which posts the chatter messsge in case 


body+= ‘\ recovery no’+ (rec.name)

i want to make that as a hyperlink with recovery number so when I click on the link it should take me to respective recovery record 

help me how to achieve the same

thanks in advance 
Hi ,

I have a small query which needs clarification

1) I have a checkbox on case object which would check automatically if the case status is set to "Closed" and uncheck if its changed to "Reopened"

2) I have a workflow outbound message based on the above checkbox on case

My query is if the checkbox is checked initially and satisfies the workflow entry critiera the workflow outbound message will be queued 

If it is unchecked will the existing queue be removed automatically or will it still send the outbound message. if so how to prevent it if queued and the entry critieria is changed at a later point of stage.

Kindly help me on the same. Thanks in advance

 
Hi 

I need help on the following 


1) I have a web tab which is pointing to a third party URL 

eg: google.com

2) I want to convert the URL to a lightning tab and the URL should open under the tab on the same page when i open the tab


ease let me know how to achieve it

thanks in advance 
Hi,

I have a controller which splits the date/time from a text field to a date/time field, Its working fine, But i am getting the below apex exception

caused by: System.StringException: Starting position out of bounds: 11
Class.casedeparturedatecalculation.datecalculation: line 29, column 1

ERROR LINE:
string hour = firstDate.substring(11,13);               
 
MY CONTROLLER:

public class casedeparturedatecalculation {
    
    public static void datecalculation(List<Case> caseList )
    {
        if(caseList.size() >0 )
        {
            List<Case> caseList2  = new List<Case>();
            for(Case c: caseList)
            {
                if(c.Departure_Date_Time__c!=null){
                //Case ca = new Case();
                String firstDate = c.Departure_Date_Time__c;
                String month = firstDate.substring(3,5);
                String day = firstDate.substring(0,2);
                String year = firstDate.substring(6,10);          
                string hour = firstDate.substring(11,13);               
                string minute = firstDate.substring(14,16);               
                string second = firstDate.substring(17,19);
                  
                string stringDate = year + '-' + month + '-' + day + ' ' + hour + ':' 
                    + minute +  ':' + second;
                System.debug('stringDate:'+stringDate);
                
                Date myDate = Date.valueOf(stringDate);
                c.Updated_Departure_Date_Time__c = myDate;
                }
            
            }
        }
        
    }
    
}

Kindly help me in the same.


Thanks in Advance


 
Hi,

I need help on the below requirement as follows,

I have a TEXT field on case object which stores the value in DD:MM:YYYY HH:MM:SS (11/12/2018 11:22:23) format

I have another DATE field which i need to copy the date value alone from the previous text field and store it in date field.

Please let me know how to achieve it 

Thanks
Hi,

I want to mask a credit card number form case description if the case is having a credt card number to it , Please let me know the code to acheive this .

Thanks in advance
Hi,

I need a trigger to achieve the below requirement for which i need help as follows,

1) I want to restrict the case level access to Private for all account team members which are created under account

If i have a account and i tried to create a account team member under that account the case access should be private , either i should not see Read only or Read write
or
I should always have private access default irrespective of i select Readonly or Readwrite.

Please kindly help me 

Thanks in Advance
Hi,

I have a requirement which i need help

1) i have a email-to-case where once a case gets created in salesforce i need to verify if there is any credit number present and if so i need to make a custom checkbox on case to true based on it i need to show a pop up message on lightning action saying that this case is having credit card number

i tried using workflow regex function but if i enter any number like 012 its making the checkbox to true automatically, please let me know how can i achieve it in salesforce

Thanks in advance
Hi ,

I have the below requirement for which i need help

on the case object i have the related list where i have email object

my requirement is in the "To Address" column i should be able to send a email only from a list of 20 email addresses that i have mentioned.

second condition is if the "To address" email matches with the case email then email should be sent.

if either of the above 2 conditions are satisfied ishould be able to send a email on a email object from a case.

Let me know if it can be acheived using a validation rule if so how it can be achieved.

Thanks in advance
Hi,

I need help on the below requirement,

1) I have a approval process  which is on campaign , it updates a field called as "Approval status" on campaign based on approval or rejection

Approved -> Approval status is set to Approved
Rejected -> Approval status is set to Rejected

My req is i want to post a chatter text to the user who has created the record based on Approval status(Approval Status__c) values (approval means custom text, rejected same custom text)

I have created a process builder for the same , but whats happening is though the value for approval process gets updated on campaign the chatter post is not happening , I have to edit and save the record again to trigger the process builder action which is then posting it.

Kindly help me on this regard if a trigger can be used.
Hi ,

     I have a validation rule which should fire only on a long text area change , but it fires if its not changed , Please help me on the validation rule condition that it should fire only if the description(Long text area) is changed.

Please find my validation rule condition :
 
VALIDATION RULE :

AND( 
$Setup.EnableValidationRule__c.VR_Description_field_is_locked_QCC__c = TRUE,
ISCHANGED(Description), 
OR( 
RecordType.DeveloperName = 'CCC_Baggage', RecordType.DeveloperName = 'CCC_Complaints', RecordType.DeveloperName = 'CCC_Compliment', RecordType.DeveloperName = 'CCC_Further_Action_Required', RecordType.DeveloperName = 'QCC_Insurance_Letter_Case', RecordType.DeveloperName = 'CCC_Medical', RecordType.DeveloperName = 'CCC_On_The_Spot_Recovery', RecordType.DeveloperName = 'CCC_Query' 
) 
)

Kindly help me pls

Thanks in Advance
Hi,

I need help how to achieve the below requirement in salesforce, I need design for it

I need to design a account credit system where i can be awarded credits and deducted based on the case consumption.

Let me know how to acheive it in salesforce

Thanks in Advance
Hi,

I have a small query , just wanted to understand can we create a outbound messaging for Case  Resolution Milestone. Please let me know the process.


Thanks in Advance
Hi,

I need help on the below lines to cover in my test class , its not entering the if conditiona nd the coverage is 60%

 if(!allLinksMap.isEmpty()){
            labelList.addAll(allLinksMap.keySet());
            
            for(String labelLink : labelList){
                Custom_Links_For_Lightning__c myCustomSetting = allLinksMap.get(labelLink);
                mapLabelLink.put(myCustomSetting.Home_page_Header_Section__c+'_'+myCustomSetting.Label_for_Custom_Link__c,myCustomSetting.Links_for_Home_Page__c);
            }​

 
MY APEX CLASS :

public with sharing class BAU_CustomLinkForLightning {
    
    public static Map<String,String> mapLabelLink = new Map<String,String>();	
    
    @AuraEnabled
    public static Map<String,String> getCustomLinks(){
        system.debug('inside code***');
        Map<String, Custom_Links_For_Lightning__c> allLinksMap = Custom_Links_For_Lightning__c.getAll();
        List<String> labelList = new List<String>();
        
        if(!allLinksMap.isEmpty()){
            labelList.addAll(allLinksMap.keySet());
            
            for(String labelLink : labelList){
                Custom_Links_For_Lightning__c myCustomSetting = allLinksMap.get(labelLink);
                mapLabelLink.put(myCustomSetting.Home_page_Header_Section__c+'_'+myCustomSetting.Label_for_Custom_Link__c,myCustomSetting.Links_for_Home_Page__c);
            }
            system.debug('ALL LABEL LINK VALUES***'+mapLabelLink);
        }
        return mapLabelLink;
    }
    
}
 
MY TEST CLASS

@isTest
public class BAU_CustomLinkForLightningTest {
    @testsetup
    static void createData(){
        List<QantasConfigData__c> lstConfigData = new List<QantasConfigData__c>();
        lstConfigData.add(TestUtilityDataClassQantas.createQantasConfigData('Log Exception Logs Rec Type','Exception Logs'));
        insert lstConfigData;

        TestUtilityDataClassQantas.createQantasConfigDataAccRecType();
    }
     public static testmethod void getCustomLinkstest() {
        system.debug('*****insidemethod*******');
        //TestUtilityDataClassQantas.enableTriggers();
        BAU_CustomLinkForLightning bau = new BAU_CustomLinkForLightning();
        BAU_CustomLinkForLightning.getCustomLinks();
        List<Custom_Links_For_Lightning__c> custlinklightning= new List<Custom_Links_For_Lightning__c>();
        custlinklightning.add(new Custom_Links_For_Lightning__c(Name='A380 Cabin Update Fact sheet',Home_page_Header_Section__c='Essential Reading',Label_for_Custom_Link__c='A380 CA380 Cabin Update Fact sheet',Links_for_Home_Page__c='https://www.qantasnewsroom.com.au/wp-content/uploads/2017/08/A380-Cabin-Update-Fact-Sheet.pdf'));
        system.debug('*****custlinklightning******'+custlinklightning);
        insert custlinklightning;
     }          
 }

Pls help me , thanks
 
Hi ,

I need help for test class to cover the below class as follows, I have test class which is covering only 20% need help to cover above


 
APEX CLASS :

global with sharing class iDealPageRedirectExtn {

    public static Integer count{get; set;}
    public static Integer count2{get; set;}
    public static Integer count3{get; set;}
    public static Integer count4{get; set;}
    public iDealPageRedirectExtn(ApexPages.StandardController controller){
       
        	String accountId = ApexPages.CurrentPage().getParameters().get('id');
        if(accountId!=null){
            System.debug(count+' '+count2+' '+count3+' '+count4);
            count 	=	 0;
            count2  =	 0;
            count3	= 	 0;
            count4	=	 0;
      		 count =[select count() from Agency_Info__c where Account__c= :accountId and Recordtype.Name='Distribution' limit 1];             
        	 count2 =[select count() from Agency_Info__c where Account__c=:accountId and PCC__c!='' and Recordtype.Name='GDS' limit 1];             
             count3 =[select count() from Agency_Info__c where Account__c in (select Primary_Account__c from Account_Relation__c where Related_Account__c=:accountId and Active__c=TRUE) and PCC__c!='' limit 1];             
             count4 =[select count() from Contract__c where Account__c=:accountId];           
            System.debug(count+' '+count2+' '+count3+' '+count4);
            }
        
    }    
}

Kindly help me pls

Thanks in Advance​
Hi ,

I need help on the following requirement below as follows,

1) I have a custom button called "Convert to contract" on proposal object
2)The proposal object is linked to parent object "opportunity"

My requirement is

There is a picklist field on opportunity called "subtype__c" 

if the opportunity picklist value related to proposal was set to "Variation" then when i click on the button it should throw me an error message

if the opportunity picklist value related to proposal is set to oher values apart from "variation" then the normal flow which is happening now should happening

Help me what changes to be made in my javascript code

Thanks in Advance
MY JAVA SCRIPT BUTTON CODE:

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}

for(var i = 0; i < document.getElementsByName("convert_to_contract").length; i++) {
document.getElementsByName("convert_to_contract")[i].className = "btnDisabled";
document.getElementsByName("convert_to_contract")[i].disabled = true;
}
try{
var contrQuery = "SELECT Id, Status__c FROM Contract__c where Proposal__c=\'"+'{!Proposal__c.Id}'+"\'";

var contrRecords = sforce.connection.query(contrQuery);

var contrRecords1 = contrRecords.getArray('records');
var allowContract = true;

for(var i=0; i<contrRecords1.length; i++){
if(contrRecords1[i].Status__c != 'Rejected – Legal' && contrRecords1[i].Status__c != 'Rejected - Customer'){
allowContract = false;
}
}

if(allowContract){
var query = "SELECT Id,Name,Account__c,Commercial_TC__c,Domestic_Annual_Share__c,International_Annual_Share__c,Legal_TC__c,Opportunity__c,Contact__c,Qantas_Annual_Expenditure__c,Status__c,Valid_From_Date__c,Valid_To_Date__c,Standard__c,Additional_Change_Details__c,Deal_Type__c,MCA_Routes_Annual_Share__c,Agent_Name__c,Agent_Fax__c,Agent_Email__c,Agent_Address__c,Frequent_Flyer_Status_Upgrade__c,Frequent_Flyer_Status_Upgrade_Offer__c,Qantas_Club_Discount__c,Qantas_Club_Discount_Offer__c,TMC_Code__c,Travel_Fund__c,Travel_Fund_Amount__c,Type__c,Proposal_Start_Date__c,Proposal_End_Date__c, (SELECT Id, FareStructure__c, Comment__c, Discount__c, Discount_Threshold_AM__c, Discount_Threshold_NAM__c FROM Fare_Structure_Lists__r),(SELECT Id,Contract_Agreement__c FROM Charter_Flight_Information__r),(SELECT Id, Name FROM Attachments ORDER BY CreatedDate DESC LIMIT 1),(SELECT Id,Amount__c,Paid_As__c,Payment_Criteria__c,Payment_Frequency__c,Type__c,Proposal__c FROM Contract_Payments__r) FROM Proposal__c where Active__c=true AND Status__c=\'Accepted by Customer\' AND Id=\'"+'{!Proposal__c.Id}'+"\' limit 1";

var records = sforce.connection.query(query);

var records1 = records.getArray('records');

// Contract Creation
if(records1.length>0){
var contract = new sforce.SObject("Contract__c");

contract.Name = records1[0].Name;
contract.Account__c = records1[0].Account__c;
contract.Commercial_TC__c = records1[0].Commercial_TC__c;
contract.Contact__c = records1[0].Contact__c;
contract.Domestic_Annual_Share__c = records1[0].Domestic_Annual_Share__c;
contract.International_Annual_Share__c = records1[0].International_Annual_Share__c;
contract.Legal_TC__c = records1[0].Legal_TC__c;
contract.Opportunity__c = records1[0].Opportunity__c;
contract.Qantas_Annual_Expenditure__c = records1[0].Qantas_Annual_Expenditure__c;
contract.Proposal__c = records1[0].Id;
contract.Type__c = records1[0].Type__c;
//contract.Valid_From_Date__c = records1[0].Valid_From_Date__c;
//contract.Valid_To_Date__c = records1[0].Valid_To_Date__c;
contract.Travel_Fund__c = records1[0].Travel_Fund__c;
contract.Travel_Fund_Amount__c = records1[0].Travel_Fund_Amount__c;
contract.Standard__c = records1[0].Standard__c;
contract.Additional_Change_Details__c = records1[0].Additional_Change_Details__c;
contract.Status__c = 'Signature Required by Customer';
contract.Deal_Type__c = records1[0].Deal_Type__c;
contract.MCA_Routes_Annual_Share__c = records1[0].MCA_Routes_Annual_Share__c;
contract.Agent_Name__c = records1[0].Agent_Name__c;
contract.Agent_Fax__c = records1[0].Agent_Fax__c;
contract.Agent_Email__c = records1[0].Agent_Email__c;
contract.Agent_Address__c = records1[0].Agent_Address__c;
contract.Qantas_Club_Discount__c = records1[0].Qantas_Club_Discount__c;
contract.Frequent_Flyer_Status_Upgrade__c = records1[0].Frequent_Flyer_Status_Upgrade__c;
contract.Frequent_Flyer_Status_Upgrade_Offer__c = records1[0].Frequent_Flyer_Status_Upgrade_Offer__c;
contract.Qantas_Club_Discount__c = records1[0].Qantas_Club_Discount__c;
contract.Qantas_Club_Discount_Offer__c = records1[0].Qantas_Club_Discount_Offer__c;
contract.TMC_Code__c = records1[0].TMC_Code__c;
contract.Travel_Fund__c = records1[0].Travel_Fund__c;
contract.Travel_Fund_Amount__c = records1[0].Travel_Fund_Amount__c;
contract.Contract_Start_Date__c = records1[0].Proposal_Start_Date__c;
contract.Contract_End_Date__c = records1[0].Proposal_End_Date__c;

var rtype;

if(records1[0].Type__c == 'Qantas Business Savings'){
rtype = 'QBS - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Corporate Airfares'){
rtype = 'CA - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Adhoc'){
rtype = 'Charters Contract - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Scheduled'){
rtype = 'Charters Contract - Legal/Customer Pending';
}

var queryC = "SELECT Id, Name FROM RecordType where Name like '%"+rtype+"%' AND sObjectType='Contract__c' limit 1";
var rtypes = sforce.connection.query(queryC);

var rtypes1 = rtypes.getArray('records');
contract.RecordTypeId = rtypes1[0].Id;

var result = sforce.connection.create([contract]);

if(result[0].success == 'true'){

var contractDiscounts = records1[0].Fare_Structure_Lists__r;
if(contractDiscounts != null){
// Discount List Creation
var conDiscounts1 = contractDiscounts.getArray("records");
var discounts = [];
for(var i=0; i<conDiscounts1.length; i++){
var discount = new sforce.SObject("Contract_Discount_List__c");
discount.Approval_Comment_NAM__c = conDiscounts1[i].Approval_Comment_NAM__c;
discount.Approval_Comment_Pricing__c = conDiscounts1[i].Approval_Comment_Pricing__c;
discount.FareStructure__c = conDiscounts1[i].FareStructure__c;
discount.Comment__c = conDiscounts1[i].Comment__c;
discount.Contract__c = result[0].id;
discount.Discount__c = conDiscounts1[i].Discount__c;
discount.Discount_Threshold_AM__c = conDiscounts1[i].Discount_Threshold_AM__c;
discount.Discount_Threshold_NAM__c = conDiscounts1[i].Discount_Threshold_NAM__c;
discounts.push(discount);
}
var result1 = sforce.connection.create(discounts);
if(result1[0].success == 'false') {
alert('Exception: '+result1[0].errors.message);
}
}
var contractPayments = records1[0].Contract_Payments__r;
if(contractPayments != null){
// contractPayment List Creation
var conPay = contractPayments.getArray("records");
var cps = [];
for(var i=0; i<conPay.length; i++){
var cp = new sforce.SObject("Contract_Payments__c");
cp.Id= conPay [i].Id;
cp.Proposal__c = records1[0].Id;
cp.Contract_Agreement__c = result[0].id;
//cp.Name = conPay[i].Name;
//cp.Amount__c = conPay[i].Amount__c;
//cp.Contract_Agreement__c = conPay[i].Contract_Agreement__c;
//cp.Paid_As__c = conPay[i].Paid_As__c;
//cp.Contract_Agreement__c = result[0].id;
//cp.Payment_Criteria__c = conPay[i].Payment_Criteria__c;
//cp.Payment_Frequency__c = conPay[i].Payment_Frequency__c;
//cp.Proposal__c = records1[0].Id;
//cp.Type__c= conPay[i].Type__c;
cps.push(cp);
}
var result1 = sforce.connection.update(cps);
if(result1[0].success == 'false') {
alert('Exception: '+result1[0].errors.message);
}
}
var charters = records1[0].Charter_Flight_Information__r;
if(charters != null){
//Charters creation
var charters1 = charters.getArray("records");

var charterValues = [];

for(var i=0; i<charters1.length; i++){
var charterValue = new sforce.SObject("Charter_Flight_Information__c");
charterValue.Id = charters1[i].Id;
charterValue.Contract_Agreement__c = result[0].id;
charterValues.push(charterValue);
}
var result2 = sforce.connection.update(charterValues);
if(result2[0].success == 'false') {
alert('Exception: '+result2[0].errors.message);
}
}

if(records1[0].Attachments != null){
var attQuery = 'SELECT Id, Name, Body FROM Attachment where ParentId=\''+'{!Proposal__c.Id }'+'\' ORDER BY CreatedDate DESC LIMIT 1';
var attRecords = sforce.connection.query(attQuery);
var attRecords1 = attRecords.getArray('records');
var newAttachment = new sforce.SObject("Attachment");
newAttachment.Body = attRecords1[0].Body;
newAttachment.Name = attRecords1[0].Name;
newAttachment.ParentId = result[0].id;
var attchResult = sforce.connection.create([newAttachment]);
if(attchResult[0].success == 'false') {
alert('Exception: '+attchResult[0].errors.message);
}
}

window.location.href = '/'+result[0].id+'?retURL='+result[0].id;

}else{
alert('Exception: '+result[0].errors.message);
}
}else if(records1.length==0){
alert("{!$Label.Convert_Contract_Error}");
}
}else{
alert('Contract exist for this Proposal');
for(var i = 0; i < document.getElementsByName("convert_to_contract").length; i++) {
document.getElementsByName("convert_to_contract")[i].className = "btnDisabled";
document.getElementsByName("convert_to_contract")[i].disabled = true;
}
}
}
catch(e){
alert('An Error has Occured. Error:' +e);
}

 
Hi ,

I need help on the following requirement as follows,

I have a text field called "Latest date" which has values in "March -2017" format

I want another formula field to convert the above text to dd/mm/yyyy format


The date can be 1st of every month

I shouldnt make any changes to the existing field and need this functionality in  a new field

Help me how to acheive this

Thanks in Advance
Hi ,

I need help on the following requirement below as follows,

I have a text field called as "Latest Period date" which stores the value as March - 2017

I want another formula field which should capture a value which is 3 months prior to latest period date

for eg

if Latest period date is March -2017

then the formula field should hold Jan - 2017

if its jan 2017 

then the formula field should hold Oct - 2016

Kindly help me with the formula please

Thanks in Advance
Hi All,

I have a requirement where when a case is created via third party site to salesforce the details in the case description doesnt get the special characters such as ($,&,@!) which is coming as a space and not carried over , but when created a case manually then the special characters are visible. Please let me know if there is any way to accomodate the special characters on case description when details comes via third party site.

Thanks in Advance
Hi 

i have ave a Alex class which posts the chatter messsge in case 


body+= ‘\ recovery no’+ (rec.name)

i want to make that as a hyperlink with recovery number so when I click on the link it should take me to respective recovery record 

help me how to achieve the same

thanks in advance 
Hi,

I need help on the below requirement as follows,

I have a TEXT field on case object which stores the value in DD:MM:YYYY HH:MM:SS (11/12/2018 11:22:23) format

I have another DATE field which i need to copy the date value alone from the previous text field and store it in date field.

Please let me know how to achieve it 

Thanks
Hi,

I have a requirement which i need help

1) i have a email-to-case where once a case gets created in salesforce i need to verify if there is any credit number present and if so i need to make a custom checkbox on case to true based on it i need to show a pop up message on lightning action saying that this case is having credit card number

i tried using workflow regex function but if i enter any number like 012 its making the checkbox to true automatically, please let me know how can i achieve it in salesforce

Thanks in advance
Hi ,

     I have a validation rule which should fire only on a long text area change , but it fires if its not changed , Please help me on the validation rule condition that it should fire only if the description(Long text area) is changed.

Please find my validation rule condition :
 
VALIDATION RULE :

AND( 
$Setup.EnableValidationRule__c.VR_Description_field_is_locked_QCC__c = TRUE,
ISCHANGED(Description), 
OR( 
RecordType.DeveloperName = 'CCC_Baggage', RecordType.DeveloperName = 'CCC_Complaints', RecordType.DeveloperName = 'CCC_Compliment', RecordType.DeveloperName = 'CCC_Further_Action_Required', RecordType.DeveloperName = 'QCC_Insurance_Letter_Case', RecordType.DeveloperName = 'CCC_Medical', RecordType.DeveloperName = 'CCC_On_The_Spot_Recovery', RecordType.DeveloperName = 'CCC_Query' 
) 
)

Kindly help me pls

Thanks in Advance
Hi,

I need help on the below lines to cover in my test class , its not entering the if conditiona nd the coverage is 60%

 if(!allLinksMap.isEmpty()){
            labelList.addAll(allLinksMap.keySet());
            
            for(String labelLink : labelList){
                Custom_Links_For_Lightning__c myCustomSetting = allLinksMap.get(labelLink);
                mapLabelLink.put(myCustomSetting.Home_page_Header_Section__c+'_'+myCustomSetting.Label_for_Custom_Link__c,myCustomSetting.Links_for_Home_Page__c);
            }​

 
MY APEX CLASS :

public with sharing class BAU_CustomLinkForLightning {
    
    public static Map<String,String> mapLabelLink = new Map<String,String>();	
    
    @AuraEnabled
    public static Map<String,String> getCustomLinks(){
        system.debug('inside code***');
        Map<String, Custom_Links_For_Lightning__c> allLinksMap = Custom_Links_For_Lightning__c.getAll();
        List<String> labelList = new List<String>();
        
        if(!allLinksMap.isEmpty()){
            labelList.addAll(allLinksMap.keySet());
            
            for(String labelLink : labelList){
                Custom_Links_For_Lightning__c myCustomSetting = allLinksMap.get(labelLink);
                mapLabelLink.put(myCustomSetting.Home_page_Header_Section__c+'_'+myCustomSetting.Label_for_Custom_Link__c,myCustomSetting.Links_for_Home_Page__c);
            }
            system.debug('ALL LABEL LINK VALUES***'+mapLabelLink);
        }
        return mapLabelLink;
    }
    
}
 
MY TEST CLASS

@isTest
public class BAU_CustomLinkForLightningTest {
    @testsetup
    static void createData(){
        List<QantasConfigData__c> lstConfigData = new List<QantasConfigData__c>();
        lstConfigData.add(TestUtilityDataClassQantas.createQantasConfigData('Log Exception Logs Rec Type','Exception Logs'));
        insert lstConfigData;

        TestUtilityDataClassQantas.createQantasConfigDataAccRecType();
    }
     public static testmethod void getCustomLinkstest() {
        system.debug('*****insidemethod*******');
        //TestUtilityDataClassQantas.enableTriggers();
        BAU_CustomLinkForLightning bau = new BAU_CustomLinkForLightning();
        BAU_CustomLinkForLightning.getCustomLinks();
        List<Custom_Links_For_Lightning__c> custlinklightning= new List<Custom_Links_For_Lightning__c>();
        custlinklightning.add(new Custom_Links_For_Lightning__c(Name='A380 Cabin Update Fact sheet',Home_page_Header_Section__c='Essential Reading',Label_for_Custom_Link__c='A380 CA380 Cabin Update Fact sheet',Links_for_Home_Page__c='https://www.qantasnewsroom.com.au/wp-content/uploads/2017/08/A380-Cabin-Update-Fact-Sheet.pdf'));
        system.debug('*****custlinklightning******'+custlinklightning);
        insert custlinklightning;
     }          
 }

Pls help me , thanks
 
Hi ,

I need help on the following requirement below as follows,

1) I have a custom button called "Convert to contract" on proposal object
2)The proposal object is linked to parent object "opportunity"

My requirement is

There is a picklist field on opportunity called "subtype__c" 

if the opportunity picklist value related to proposal was set to "Variation" then when i click on the button it should throw me an error message

if the opportunity picklist value related to proposal is set to oher values apart from "variation" then the normal flow which is happening now should happening

Help me what changes to be made in my javascript code

Thanks in Advance
MY JAVA SCRIPT BUTTON CODE:

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}

for(var i = 0; i < document.getElementsByName("convert_to_contract").length; i++) {
document.getElementsByName("convert_to_contract")[i].className = "btnDisabled";
document.getElementsByName("convert_to_contract")[i].disabled = true;
}
try{
var contrQuery = "SELECT Id, Status__c FROM Contract__c where Proposal__c=\'"+'{!Proposal__c.Id}'+"\'";

var contrRecords = sforce.connection.query(contrQuery);

var contrRecords1 = contrRecords.getArray('records');
var allowContract = true;

for(var i=0; i<contrRecords1.length; i++){
if(contrRecords1[i].Status__c != 'Rejected – Legal' && contrRecords1[i].Status__c != 'Rejected - Customer'){
allowContract = false;
}
}

if(allowContract){
var query = "SELECT Id,Name,Account__c,Commercial_TC__c,Domestic_Annual_Share__c,International_Annual_Share__c,Legal_TC__c,Opportunity__c,Contact__c,Qantas_Annual_Expenditure__c,Status__c,Valid_From_Date__c,Valid_To_Date__c,Standard__c,Additional_Change_Details__c,Deal_Type__c,MCA_Routes_Annual_Share__c,Agent_Name__c,Agent_Fax__c,Agent_Email__c,Agent_Address__c,Frequent_Flyer_Status_Upgrade__c,Frequent_Flyer_Status_Upgrade_Offer__c,Qantas_Club_Discount__c,Qantas_Club_Discount_Offer__c,TMC_Code__c,Travel_Fund__c,Travel_Fund_Amount__c,Type__c,Proposal_Start_Date__c,Proposal_End_Date__c, (SELECT Id, FareStructure__c, Comment__c, Discount__c, Discount_Threshold_AM__c, Discount_Threshold_NAM__c FROM Fare_Structure_Lists__r),(SELECT Id,Contract_Agreement__c FROM Charter_Flight_Information__r),(SELECT Id, Name FROM Attachments ORDER BY CreatedDate DESC LIMIT 1),(SELECT Id,Amount__c,Paid_As__c,Payment_Criteria__c,Payment_Frequency__c,Type__c,Proposal__c FROM Contract_Payments__r) FROM Proposal__c where Active__c=true AND Status__c=\'Accepted by Customer\' AND Id=\'"+'{!Proposal__c.Id}'+"\' limit 1";

var records = sforce.connection.query(query);

var records1 = records.getArray('records');

// Contract Creation
if(records1.length>0){
var contract = new sforce.SObject("Contract__c");

contract.Name = records1[0].Name;
contract.Account__c = records1[0].Account__c;
contract.Commercial_TC__c = records1[0].Commercial_TC__c;
contract.Contact__c = records1[0].Contact__c;
contract.Domestic_Annual_Share__c = records1[0].Domestic_Annual_Share__c;
contract.International_Annual_Share__c = records1[0].International_Annual_Share__c;
contract.Legal_TC__c = records1[0].Legal_TC__c;
contract.Opportunity__c = records1[0].Opportunity__c;
contract.Qantas_Annual_Expenditure__c = records1[0].Qantas_Annual_Expenditure__c;
contract.Proposal__c = records1[0].Id;
contract.Type__c = records1[0].Type__c;
//contract.Valid_From_Date__c = records1[0].Valid_From_Date__c;
//contract.Valid_To_Date__c = records1[0].Valid_To_Date__c;
contract.Travel_Fund__c = records1[0].Travel_Fund__c;
contract.Travel_Fund_Amount__c = records1[0].Travel_Fund_Amount__c;
contract.Standard__c = records1[0].Standard__c;
contract.Additional_Change_Details__c = records1[0].Additional_Change_Details__c;
contract.Status__c = 'Signature Required by Customer';
contract.Deal_Type__c = records1[0].Deal_Type__c;
contract.MCA_Routes_Annual_Share__c = records1[0].MCA_Routes_Annual_Share__c;
contract.Agent_Name__c = records1[0].Agent_Name__c;
contract.Agent_Fax__c = records1[0].Agent_Fax__c;
contract.Agent_Email__c = records1[0].Agent_Email__c;
contract.Agent_Address__c = records1[0].Agent_Address__c;
contract.Qantas_Club_Discount__c = records1[0].Qantas_Club_Discount__c;
contract.Frequent_Flyer_Status_Upgrade__c = records1[0].Frequent_Flyer_Status_Upgrade__c;
contract.Frequent_Flyer_Status_Upgrade_Offer__c = records1[0].Frequent_Flyer_Status_Upgrade_Offer__c;
contract.Qantas_Club_Discount__c = records1[0].Qantas_Club_Discount__c;
contract.Qantas_Club_Discount_Offer__c = records1[0].Qantas_Club_Discount_Offer__c;
contract.TMC_Code__c = records1[0].TMC_Code__c;
contract.Travel_Fund__c = records1[0].Travel_Fund__c;
contract.Travel_Fund_Amount__c = records1[0].Travel_Fund_Amount__c;
contract.Contract_Start_Date__c = records1[0].Proposal_Start_Date__c;
contract.Contract_End_Date__c = records1[0].Proposal_End_Date__c;

var rtype;

if(records1[0].Type__c == 'Qantas Business Savings'){
rtype = 'QBS - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Corporate Airfares'){
rtype = 'CA - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Adhoc'){
rtype = 'Charters Contract - Legal/Customer Pending';
}else if(records1[0].Type__c == 'Scheduled'){
rtype = 'Charters Contract - Legal/Customer Pending';
}

var queryC = "SELECT Id, Name FROM RecordType where Name like '%"+rtype+"%' AND sObjectType='Contract__c' limit 1";
var rtypes = sforce.connection.query(queryC);

var rtypes1 = rtypes.getArray('records');
contract.RecordTypeId = rtypes1[0].Id;

var result = sforce.connection.create([contract]);

if(result[0].success == 'true'){

var contractDiscounts = records1[0].Fare_Structure_Lists__r;
if(contractDiscounts != null){
// Discount List Creation
var conDiscounts1 = contractDiscounts.getArray("records");
var discounts = [];
for(var i=0; i<conDiscounts1.length; i++){
var discount = new sforce.SObject("Contract_Discount_List__c");
discount.Approval_Comment_NAM__c = conDiscounts1[i].Approval_Comment_NAM__c;
discount.Approval_Comment_Pricing__c = conDiscounts1[i].Approval_Comment_Pricing__c;
discount.FareStructure__c = conDiscounts1[i].FareStructure__c;
discount.Comment__c = conDiscounts1[i].Comment__c;
discount.Contract__c = result[0].id;
discount.Discount__c = conDiscounts1[i].Discount__c;
discount.Discount_Threshold_AM__c = conDiscounts1[i].Discount_Threshold_AM__c;
discount.Discount_Threshold_NAM__c = conDiscounts1[i].Discount_Threshold_NAM__c;
discounts.push(discount);
}
var result1 = sforce.connection.create(discounts);
if(result1[0].success == 'false') {
alert('Exception: '+result1[0].errors.message);
}
}
var contractPayments = records1[0].Contract_Payments__r;
if(contractPayments != null){
// contractPayment List Creation
var conPay = contractPayments.getArray("records");
var cps = [];
for(var i=0; i<conPay.length; i++){
var cp = new sforce.SObject("Contract_Payments__c");
cp.Id= conPay [i].Id;
cp.Proposal__c = records1[0].Id;
cp.Contract_Agreement__c = result[0].id;
//cp.Name = conPay[i].Name;
//cp.Amount__c = conPay[i].Amount__c;
//cp.Contract_Agreement__c = conPay[i].Contract_Agreement__c;
//cp.Paid_As__c = conPay[i].Paid_As__c;
//cp.Contract_Agreement__c = result[0].id;
//cp.Payment_Criteria__c = conPay[i].Payment_Criteria__c;
//cp.Payment_Frequency__c = conPay[i].Payment_Frequency__c;
//cp.Proposal__c = records1[0].Id;
//cp.Type__c= conPay[i].Type__c;
cps.push(cp);
}
var result1 = sforce.connection.update(cps);
if(result1[0].success == 'false') {
alert('Exception: '+result1[0].errors.message);
}
}
var charters = records1[0].Charter_Flight_Information__r;
if(charters != null){
//Charters creation
var charters1 = charters.getArray("records");

var charterValues = [];

for(var i=0; i<charters1.length; i++){
var charterValue = new sforce.SObject("Charter_Flight_Information__c");
charterValue.Id = charters1[i].Id;
charterValue.Contract_Agreement__c = result[0].id;
charterValues.push(charterValue);
}
var result2 = sforce.connection.update(charterValues);
if(result2[0].success == 'false') {
alert('Exception: '+result2[0].errors.message);
}
}

if(records1[0].Attachments != null){
var attQuery = 'SELECT Id, Name, Body FROM Attachment where ParentId=\''+'{!Proposal__c.Id }'+'\' ORDER BY CreatedDate DESC LIMIT 1';
var attRecords = sforce.connection.query(attQuery);
var attRecords1 = attRecords.getArray('records');
var newAttachment = new sforce.SObject("Attachment");
newAttachment.Body = attRecords1[0].Body;
newAttachment.Name = attRecords1[0].Name;
newAttachment.ParentId = result[0].id;
var attchResult = sforce.connection.create([newAttachment]);
if(attchResult[0].success == 'false') {
alert('Exception: '+attchResult[0].errors.message);
}
}

window.location.href = '/'+result[0].id+'?retURL='+result[0].id;

}else{
alert('Exception: '+result[0].errors.message);
}
}else if(records1.length==0){
alert("{!$Label.Convert_Contract_Error}");
}
}else{
alert('Contract exist for this Proposal');
for(var i = 0; i < document.getElementsByName("convert_to_contract").length; i++) {
document.getElementsByName("convert_to_contract")[i].className = "btnDisabled";
document.getElementsByName("convert_to_contract")[i].disabled = true;
}
}
}
catch(e){
alert('An Error has Occured. Error:' +e);
}

 
Hi,

I have a trigger which is updating account id on case object , The logic is working fine, I just want to bulkify the trigger with the best coding standards as i have written a query inside a for loop

Kindly help me with that pls
 
MY TRIGGER :

trigger trgAccountAutopopulate  on Case (before insert,before update) {


if(Trigger.isbefore){
Id groupwaiversRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Group Waivers').getRecordTypeId();
for(Case casenew: Trigger.new){

if(casenew.Recordtypeid==groupwaiversRecordTypeId ){
if(casenew.IATA_DAI__c!=null){
Account AccIATA=[Select id, IATA_Number__c from account where IATA_Number__c =: casenew.IATA_DAI__c limit 1];
casenew.Accountid=AccIATA.id;
}

if(casenew.TIDS__c!=null){
Account AccTIDS=[Select id, Agency_TIDS_Number__c from account where Agency_TIDS_Number__c =: casenew.TIDS__c limit 1];
casenew.Accountid=AccTIDS.id;

}

}
}


}
}

Thanks in Advance
Hi,

I have a controller for which i have written a test class which covers only 50%, I am not able to cover the following lines for which i need help on it

//
   if(firstcontract.Contract_Start_Date__c<contractObj.Contract_Start_Date__c && firstcontract.Contract_End_Date__c<contractObj.Contract_End_Date__c ){
                          if(firstcontract.Contract_End_Date__c>=contractObj.Contract_Start_Date__c){
                          firstcontract.Contract_End_Date__c=contractObj.Contract_Start_Date__c.addDays(-1);
                          update firstcontract;//put the list and update
                          }                       
                        }  
                        else{
                        system.debug('elsesection');
                        if(contractObj.Contract_End_Date__c>=firstcontract.Contract_Start_Date__c){
                          contractObj.Contract_End_Date__c=firstcontract.Contract_Start_Date__c.addDays(-1);
                          update contractObj;// put the list and update
                          }    
                          
                          
                          //
                          
                            if(idVsContractmap.containsKey(controbj.Account__r.Id)) {
                List<Contract__c> contrAccList = idVsContractmap.get(controbj.Account__r.Id);
                contrAccList.add(controbj);
                idVsContractmap.put(controbj.Account__c, contrAccList);
            } else {
                idVsContractmap.put(controbj.Account__c, new List<Contract__c> { controbj });
            }   
            //

Kindly help me pls

Thanks in advance
Hi,

I need help on the following requirement below as follows,

1) I have a account object where contract is another object related to account

2) Contract object is having contract start date and end date which populates to account 

My scenario is 

3)If there are 2 active contract associcated to account and the dates contain

1st Active contracts dates are

start date :1.feb 2017
end date : 31st march 2017

2nd active contract dates are

start date : 1st march 2017
end date : 17th sep 2017

then in this scenatio the first active contract end date should be automatically backdated to the previous month below as follows to avoid overlapping between 2 contracts

1st active contract end date should automatically be changed to 

end date :28th feb 2017
start date should remain the same as 1 feb 2017.

basically both contracts end dates and start dates shouldnt fall in same range to avoid overlapping


I tried the below apex class
 
public class overlapDateHandler{

	public void overlapDateMethod(list<Contract__c> contractList){
	
		set<Id> accountIdSet = new set<Id>();
		list<Account> accList = new List<Account>();
		map<integer, integer> dateMap = new map<integer, integer>{
		1 => 31, 
		3 => 31, 
		4 =>30, 
		5 =>31, 
		6 => 30, 
		7 => 31, 
		8 => 31, 
		9 =>30, 
		10 =>31, 
		11 =>30, 
		12 =>31, };
		map<id, list<Contract__c>> idVsContractmap = new map<id, list<Contract__c>>();
		list<Contract__c> updateContractList = new list<Contract__c>();
		for(Contract__c conObj : contractList){
			
			if(conObj.AccountId  != null){
				
				accountIdSet.add(conObj.AccountId);
			}
		}
		accList = [Select Id, (Select Contract_Start_Date__c, Contract_End_Date__c, AccountId From Contract__c) From Account Where Id IN :accountIdSet]
		for(Account accObj : accList){
			
			idVsContractmap.put(accObj.id, accObj.Contract__c);
		}
		for(Contract__c conObj : contractList){
			
			if(conObj.AccountId != null){
			
				if(idVsContractmap.containsKey(conObj.AccountId)){
					
					for(Contract contractObj : idVsContractmap.get(conObj.AccountId)){
						
						if(contractObj.Contract_End_Date__c.month() == conObj.startdate__c.month()){
							
							if(contractObj.Contract_End_Date__c.month() - 1 == 2){
							
								if(MOD( contractObj.Contract_End_Date__c.year()) + 1, 4) = 0){
									
									string newDate = 29 +'//'+contractObj.Contract_End_Date__c.month() - 1+'//'+contractObj.Contract_End_Date__c.year();
									contractObj.Contract_End_Date__c =  date.parse(newDate);
								}
								else{
									
									string newDate = 28 +'//'+contractObj.Contract_End_Date__c.month() - 1+'//'+contractObj.Contract_End_Date__c.year();
									contractObj.Contract_End_Date__c =  date.parse(newDate);
								}
							}
							else if(contractObj.Contract_End_Date__c.month() - 1 == 0){
								
								string newDate = 31 +'//'+12+'//'+contractObj.Contract_End_Date__c.year() -1;
								contractObj.Contract_End_Date__c =  date.parse(newDate);
							}
							else{
								
								string newDate = 31 +'//'+dateMap.get(contractObj.Contract_End_Date__c.month() - 1)+'//'+contractObj.Contract_End_Date__c.year() -1;
								contractObj.Contract_End_Date__c =  date.parse(newDate);
							}
						}
						updateContractList.add(contractObj);
					}
				}
			}
		}
		update updateContractList;
	}
}

I am gettingthe below error

Error: Compile Error: unexpected token: '}' at line 18 column 17

12 =>31, };

Help me pls

 
Hi,

I am getting the following error on my apex class

Error: Compile Error: unexpected syntax: 'mismatched input ',' expecting MAPPED_TO' at line 18 column 11


Help me how to fix it

Thanks in Advance
MY APEX CLASS :


public class overlapDateHandler{

    public void overlapDateMethod(list<contract> contractList){
    
        set<Id> accountIdSet = new set<Id>();
        list<Account> accList = new List<Account>();
        map<integer, integer> dateMap = new map<integer, integer>{
        1 => 31, 
        3 => 31, 
        4 =>30, 
        5 =>31, 
        6 => 30, 
        7 => 31, 
        8 => 31, 
        9 =>30, 
        10 =>31, 
        11 =>30, 
        12, 31, };
        map<id, list<Contract>> idVsContractmap = new map<id, list<contract>>();
        list<Contract> updateContractList = new list<Contract>();
        for(Contract conObj : contractList){
            
            if(conObj.AccountId  != null){
                
                accountIdSet.add(conObj.AccountId);
            }
        }
        accList = [Select Id, (Select startdate__c, enddate__c, AccountId From Contracts) From Account Where Id IN :accountIdSet]
        for(Account accObj : accList){
            
            idVsContractmap.put(accObj.id, accObj.Contracts);
        }
        for(Contract conObj : contractList){
            
            if(conObj.AccountId != null){
            
                if(idVsContractmap.containsKey(conObj.AccountId)){
                    
                    for(Contract contractObj : idVsContractmap.get(conObj.AccountId)){
                        
                        if(contractObj.enddate__c.month() == conObj.startdate__c.month()){
                            
                            if(contractObj.enddate__c.month() - 1 == 2){
                            
                                if(MOD( contractObj.enddate__c.year()) + 1, 4) = 0){
                                    
                                    string newDate = 29 +'//'+contractObj.enddate__c.month() - 1+'//'+contractObj.enddate__c.year();
                                    contractObj.enddate__c =  date.parse(newDate);
                                }
                                else{
                                    
                                    string newDate = 28 +'//'+contractObj.enddate__c.month() - 1+'//'+contractObj.enddate__c.year();
                                    contractObj.enddate__c =  date.parse(newDate);
                                }
                            }
                            else if(contractObj.enddate__c.month() - 1 == 0){
                                
                                string newDate = 31 +'//'+12+'//'+contractObj.enddate__c.year() -1;
                                contractObj.enddate__c =  date.parse(newDate);
                            }
                            else{
                                
                                string newDate = 31 +'//'+dateMap.get(contractObj.enddate__c.month() - 1)+'//'+contractObj.enddate__c.year() -1;
                                contractObj.enddate__c =  date.parse(newDate);
                            }
                        }
                        updateContractList.add(contractObj);
                    }
                }
            }
        }
        update updateContractList;
    }
}