• Sem Ingraf
  • NEWBIE
  • 20 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 0
    Replies

hello everyone, 

I need some help to be able to get the infomrations of this small part of JSON : 

 

"cancellation_policies":{
   "alidays":[
      {
         "text_message":"Penale voli emessi o non emessi: 200 euro a persona",
         "penalty":{
            "money":{
               "currency":"EUR",
               "amount":500
            }
         }
      }
   ],
   "agency":[
      {
         "text_message":"Penale voli emessi o non emessi: 200 euro a persona",
         "penalty":{
            "money":{
               "currency":"EUR",
               "amount":875.43
            }
         }
      }
   ]
}




I say small part since the passed JSON turns out to be much larger, but I am having difficulty with getting the data from this part only. 

I created my wrapper class to help me with the deserialization after I wrote this to be able to get the "cancellation_policies" part 

 

 

public Map<String, Object> serviceInfo;
this.serviceInfo = (Map<String, Object>) deserializedObj.get('cancellation_policies');
        system.debug('cancellation_policies' +serviceInfo);


Now, however, i cannot get the information that is within my two lists : alidays and agency, 

I should save the information to custom fields such as : 


CancellationPolicies__c = alidays.text_message;
CancellationPoliciesPublic__c =agencies.text_message;
AlidayPolicieAmount__c alidays.penalty.money.amount;
etc.
 

Thanks for help. 

Hello everyone. 
 
a user reports that he can't see some opportunities when he tries to perform the "log email" operation in the outlook integration with salesforce, preventing him from performing the log operation correctly. 
 
There are no sharing rules, the user can view the opportunities. 
the email-to Salesforce and Enhanced Email appear to be active.
In addition, the flag:  Opportunities
Email is associated with all of the contact's open opportunities, present in Personal Setting -> in My Email to Salesforce appears to be enabled.
 
What could be the cause of this ? 
 
Thank you. 

Hi,
 
during inserting mail from outlook to salesforce.
this strange error is displayed : An unexpected error occurred. Try refreshing the page, and if the problem continues contact your system administrator.
 
It does not occur often but sometimes it does and it is really annoying.

I would like to know what causes it is there any way I can solve it?
Thanks.

User-added image

Hi,

i have a process builder that after checking a criteria if it is true, sends an email via email alerts.
Now i would like to be able to save the email  in a custom field in the Account object is it possible? 

Hi,
i have a trigger on the emailMessage object. I have a removeReplyText method that searches for some strings inside the TextBody and Htmlbody of the emailMessage object and deletes/hides it in order to streamline the display of the email when it is copied/stored on a case
 

private static void removeReplyText(List<EmailMessage> newObjects){
        Map<Id, Case> casesMap;
        Set<Id> caseIds = new Set<Id>();
        List<EmailMessage> emsToUpdate = new List<EmailMessage>();
        for(EmailMessage em : newObjects){
            System.debug('Clean body: ' + em.Id + ' - Parent: ' + em.ParentId);
            System.debug('Clean TXT: ' + em.TextBody);
            System.debug('Clean HTML: ' + em.HtmlBody);
            

            if(em.ParentId != null){
                caseIds.add(em.ParentId);
            }
        }
        casesMap = new Map<Id, Case>(getCases(caseIds));
        System.debug('CaseMap' +casesMap);
        
        

        for(EmailMessage em: newObjects){
            Case myCase = casesMap.get(em.ParentId);
            Boolean changed = false;
            if(myCase != null){
                System.debug('Found case');
                String body = em.TextBody;
                if(String.isNotBlank(em.TextBody)) {
                    Integer occurrence1 = body.indexOfIgnoreCase(Constants.EMAIL_QUOTEDBODY_1);
                    Integer occurrence2 = body.indexOfIgnoreCase(Constants.EMAIL_QUOTEDBODY_2);
                    Integer occurrence = occurrence1 != -1 && occurrence2 != -1 && occurrence1 < occurrence2 ? occurrence1 : occurrence2;

                    //system.debug('occurrence3' +occurrence3);

                    if (occurrence != -1) {
                        body = body.substring(0, occurrence);
//                        em.TextBody = body;
                        changed = true;
                    }
                    
        
                    system.debug('Constants.EMAIL_FooterPlain' +Constants.EMAIL_FooterPlain);

                    Integer occurrenceFooter = body.indexOfIgnoreCase(Constants.EMAIL_FooterPlain);
                    if (occurrenceFooter != -1) {
                        body = body.substring(0, occurrenceFooter);
//                        em.TextBody = body;
                        changed = true;
                    }
                }

                String htmlBody = em.HtmlBody;
                if(String.isNotBlank(em.HtmlBody)) {
                    System.debug('HTML Body');
                    Integer occurrenceh1 = htmlBody.indexOfIgnoreCase(Constants.EMAIL_QUOTEDBODY_1);
                    System.debug('occurrenceh1: ' + occurrenceh1);

                    Integer occurrenceh2 = htmlBody.indexOfIgnoreCase(Constants.EMAIL_QUOTEDBODY_2);
                    System.debug('occurrenceh2: ' + occurrenceh2);
                    

                    Integer occurrenceh = occurrenceh1 != -1 && occurrenceh2 != -1 && occurrenceh1 < occurrenceh2 ? occurrenceh1 : occurrenceh2;
                    System.debug('occurrenceh: ' + occurrenceh);
                    
                        

                    if (occurrenceh != -1) {
                        htmlBody = htmlBody.substring(0, occurrenceh);            
                        htmlBody += '</body> </html>';
//                        em.HtmlBody = htmlBody;
                        System.debug('new em.HtmlBody: ' + em.HtmlBody);
                        changed = true;
                    }
                    
                
                    system.debug('Constants.EMAIL_FooterHTML' +Constants.EMAIL_FooterHTML);

                    Integer occurrenceFooter = htmlBody.indexOfIgnoreCase(Constants.EMAIL_FooterHTML);
                    if (occurrenceFooter != -1) {
                        htmlBody = htmlBody.substring(0, occurrenceFooter);
//                        em.TextBody = body;
                        changed = true;
                    }
                }
                if (changed){
                    emsToUpdate.add(new EmailMessage(Id=em.Id, TextBody=body, HtmlBody=htmlBody));
                }

            }
        }

        update emsToUpdate;
    }
now I would like to modify this method to be able to delete/hide this initial piece as well :
Rif. Preventivo {{{Quote.Name}}} ({{{Quote.IdPreventivo__c}}})
Stato: {{{Quote.TranslatedStatus__c}}}
Mittente: {{{Sender.Name}}}



how could I do? is it possible to do this? I initially did a test with replace and replaceAll but without success.

Thanks for any help
HI,
if I try to create a new palette in the field service (Gantt).

When I go to save, it goes into error generating this message : 
DML Not Allowed - GanttPalette__c - saveGanttPalette

User-added image