• Adelchi Pelizzo
  • NEWBIE
  • 115 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 36
    Questions
  • 58
    Replies

Inbound Email service works ok relating EmailMessage to Case and Account>

Not working for Contact.
FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Related To ID: id value of incorrect type: 0038d00000BozV3AAJ: [RelatedToId]

I tried also EmailMessageRelation object, same behavior:
FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Relation ID: id value of incorrect type: 0018d00000D5eT0AAJ: [RelationId]

I deploy a trigger within a managed package and it does not run.

I copy and paste the trigger's code lines, to a new trigger on the same host org, and it works? Besides their name they are identical.

 

trigger Trigger_Name_1 on Account (before update) {
    SObject so = Schema.getGlobalDescribe().get('Account').newSObject();
    Boolean b = so.getSobjectType().getDescribe().fields.getMap().containsKey('Labels__c');
    if(b){
        List<Account> oldAcc = Trigger.oldMap.values();
        List<Account> newAcc = Trigger.newMap.values();
        for(Integer i = 0; i < oldAcc.size(); i++){
            if(b && oldAcc[i].Labels__c != newAcc[i].Labels__c){
                System.debug('Inside if ...');
                newAcc[i].adelAnyLab__Labels__c = newAcc[i].Labels__c;
                system.debug(newAcc[i].adelAnyLab__Labels__c);
            }
        }
    }
}


trigger Trigger_Name_2 on Account (before update) {
    SObject so = Schema.getGlobalDescribe().get('Account').newSObject();
    Boolean b = so.getSobjectType().getDescribe().fields.getMap().containsKey('Labels__c');
    if(b){
        List<Account> oldAcc = Trigger.oldMap.values();
        List<Account> newAcc = Trigger.newMap.values();
        for(Integer i = 0; i < oldAcc.size(); i++){
            if(b && oldAcc[i].Labels__c != newAcc[i].Labels__c){
                System.debug('Inside if ...');
                newAcc[i].adelAnyLab__Labels__c = newAcc[i].Labels__c;
                system.debug(newAcc[i].adelAnyLab__Labels__c);
            }
        }
    }
}
 
I need my Apex Rest method HttpPost, to consume a json object where the first name-value pair is:
 
{
"string with spaces" : "string_without_spaces",
... }


 
If I set parameter as a generic Object, I am getting : "Post methods do not support parameter type of Object" 
**** PLEASE do NOT post links or suggestions to trailhead/help. This is NOT what I am asking. Thank you. *****

Anyone experiencing the following error reply please.

Reference ID: XKRQFLHI. Error: Restforce::UnauthorizedError. Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE

First challenge. Contact has been created and everything work as expected. Why this error?


**** PLEASE do NOT post links or suggestions to trailhead/help. This is NOT what I am asking. Thank you. *****

reference ID: XKRQFLHI. Error: Restforce::UnauthorizedError. Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE

First challenge. Contact has been created and everything work as expected. Why this error?

**** PLEASE do NOT post links to trailhead/help. This is NOT what I am asking. Thankyou. *****

reference ID: XKRQFLHI. Error: Restforce::UnauthorizedError. Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE

First challenge. Contact has been created and everything work as expected. Why this error?
Trailhead "Lightning Web Components and Salesforce Data" first challenge.
Contact has been created and everything work as expected. Why this error?
Custom button displays a lightning component for record edit. 
 
Note: Custom button displays a modal for record edit. 

Inside a lightning component, I make an API call to "/services/data/v46.0/sobjects/ ..."

Lightning requires authorization even if the call is done internally. (Sounds weird to me).

I want to have this OAuth process run silewntly in the back ground.

 

<!--            <ui:scrollerWrapper  class="scroll" >-->
    <aura:iteration items="{!v.commentsData}" var="comment" indexVar="key">
        <lightning:card class="{!comment.Color == 'grey' ? 'grey' : 'blue'}" aura:id="{!comment.Color}+{!key}">
            {!comment.text}
        </lightning:card>
    </aura:iteration>
    <!--    </ui:scrollerWrapper>-->
If ui:scrollerWrapper is uncommented, the class in card element does not work.
 
If third party cookies are disabled in Chrome, the central panel does not show?User-added image
No output returned after scratch org has been created using Jenkinsfile:
 
stage('Create Scratch Org') {
            rmsg = bat returnStdout: true, script: "${toolbelt} sfdx force:org:create --definitionfile config/project-scratch-def.json --json --setdefaultusername"
           // rmsg is: null
            println("Returned>>" + printf(rmsg))
           // log : Returned >> null
            printf rmsg
            def jsonSlurper = new JsonSlurperClassic()
            def robj = jsonSlurper.parseText(rmsg)
            if (robj.status != "ok") { error 'org creation failed: ' + robj.message }
            SFDC_USERNAME=robj.result.username
            robj = null

        }

The scratch org is created ok.

Thank you for any comment.
Adelchi
After submitting my challenge, I get this error:
 
Challenge Not yet complete... here's what's wrong: 
The ProjectRESTService class did not achieve at least 90% code coverage via your test methods. Make sure that you chose 'Run All' tests in the Developer Console at least once before attempting to verify this challenge.

While the Code Coverage shown in Dev Console is 94% and lines covered 16/17 .

Please help.
public class CaseListCtrl {
    public String s1 {get;set;}
    public String s2 {get;set;}
    public String s3 {get;set;}
    public String s4 {get;set;}
    public String s5 {get;set;}
    public String s6 {get;set;}
    public String s7 {get;set;}
    
    /*List<Case> caseList = [SELECT Id, Labels2__c FROM Case Limit 20];
    
    ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(caseList);*/
    
    private final Case c;
    
    public CaseListCtrl(ApexPages.StandardSetController controller) {
        this.c = (Case)controller.getRecord();
    }
    
    public List <Case> getCases(){
        return [SELECT Id, Labels2__c FROM  Case];
    }
    
    public List<Case> caseRecords {
        get {
            return [SELECT Id, Labels2__c FROM Case];
        }
        private set;
    }
    
    /*public List<Case> getCaseListCtrl() {
        return (List<Case>) caseRecords.getRecords();
    }*/
    
    Public ApexPages.Action getIt(){
        List<List<String>> lstS = new List<List<String>>();
        String[] setS = new List<String>();
        for (integer i = 0; i < 20; i++){
            Case cR = caseRecords[i];
        	lstS.add(cr.Labels2__c.split(';'));
        }
        if (lstS != null){
            for (integer i = 1; i < lstS.size(); i++){
                s1 = lstS.get(i)[0];
                s2 = lstS.get(i)[1];
                s1 = lstS.get(i)[2];
                s2 = lstS.get(i)[3];
                s1 = lstS.get(i)[4];
                s2 = lstS.get(i)[5];
                s1 = lstS.get(i)[6];
                s2 = lstS.get(i)[7];
            }
        }
		return null;
    }
}
<apex:page standardController="Case" recordSetVar="cases" sidebar="true" standardstylesheets="false" showheader="true" extensions="CaseListCtrl" action="{!getIt}">
<apex:form >
    {!s1}
    {!s2}
    {!s3}
    {!s4}
    {!s5}
    {!s6}
    {!s7}

</apex:form>
</apex:page>

My intent is to grab values from a multi-picklist field "labels2__c" and display it as a single value in a visualforce page.

This is the error: 

 

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!getIt}' in component <apex:page> in page testctrlcase: Class.CaseListCtrl.getIt: line 40, column 1
Class.CaseListCtrl.getIt: line 40, column 1

Thanks,
Adelchi

I am trying to generate Enterprise WSDL file, it hangs and I get this and NOT the file:

User-added image
I want to show two fields value in a flow screen, but at the moment it gives me null. I use an Invocable method to retrieve a json file, indetify and store only those two values in a subclass containing two invocablevariable. After executing it in dev console, I can print out in system.debug at line 21 and 26 but not at line 33.
 
global class par{
@InvocableMethod(label='Get Map' description='Returns the values of Maps')
    global static List<adel.par.VarWrap> CallMap(){
        List<adel.par.VarWrap> wraps = new List<adel.par.VarWrap>();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyBOyIQi54LMykmzSOvCuQ2naVvVQEsEfHw');
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken()!= null)
        {  
            adel.par.VarWrap wrap = new adel.par.VarWrap();
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME)
             {
                string fieldName = parser.getText();
                parser.nextToken();
                if(fieldName == 'place_id')
                {
                    wrap.placeRet = parser.getText();
                    system.debug(wrap.placeRet);
                    parser.nextToken();
                }else if(fieldName == 'status')
                    {
                    wrap.statusRet = parser.getText();
                    system.debug(wrap.statusRet);
                    }
                    
            }
            wraps.add(wrap);
        }
        
        system.debug(wraps);
        return wraps;  
    }
    global class VarWrap{
        @InvocableVariable(label='Place')
        public String placeRet;
        @InvocableVariable(label='Status')
        public String statusRet;       
    } 
}
I understand InvocableMethods can return only lists. It would work if the sObject VarWrap contained only one field value.
 
I am getting this error: The number of results does not match the number of interviews that were executed in a single bulk execution request.
Here is the apex class I am using, I want to store list<string> data from a json file into a flow variable:
global class par{

    global static List<string> l = new list<string>();
    
@InvocableMethod(label='Get Map' description='Returns the values of Maps')
    global static List<String> CallMap(){
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyBOyIQi54LMykmzSOvCuQ2naVvVQEsEfHw');
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken()!= null)
        {
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME))
            {
                    string fieldName = parser.getText();
                    parser.nextToken();
                if(fieldName == 'place_id')
                {
                    string place = parser.getText();
                    system.debug(place);
                    l.add(place);
                	parser.nextToken();
                }else if(fieldName == 'status')
                	{
                    string status = parser.getText();
                    system.debug(status);
                    l.add(status);
                    }
        	}
    	}
        return l;
    }
}



 

 
Is string unsupported for @InvocableMethod ?
I cannot find any doc about this.

User-added image
In the instruction there is a phrase I do not understand: It beats sliced bread hands down! Can you use English language to explain this?
Thanks.........

Inbound Email service works ok relating EmailMessage to Case and Account>

Not working for Contact.
FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Related To ID: id value of incorrect type: 0038d00000BozV3AAJ: [RelatedToId]

I tried also EmailMessageRelation object, same behavior:
FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Relation ID: id value of incorrect type: 0018d00000D5eT0AAJ: [RelationId]

reference ID: XKRQFLHI. Error: Restforce::UnauthorizedError. Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE

First challenge. Contact has been created and everything work as expected. Why this error?

**** PLEASE do NOT post links to trailhead/help. This is NOT what I am asking. Thankyou. *****

reference ID: XKRQFLHI. Error: Restforce::UnauthorizedError. Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE

First challenge. Contact has been created and everything work as expected. Why this error?
Trailhead "Lightning Web Components and Salesforce Data" first challenge.
Contact has been created and everything work as expected. Why this error?
Hi all, I am working on the Handle Server Error part in Trailhead as part of the Lightning Web Components and Salesforce Data Module

https://trailhead.salesforce.com/en/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors?trail_id=build-lightning-web-components

I am attempting to allow for error handling and write my code as follows

ContactList.js
import { LightningElement, wire } from 'lwc';
import {
    reduceErrors
} from 'c/ldsUtils';
import getContactList from '@salesforce/apex/ContactController.getContactList';

export default class ContactList extends LightningElement {
    @wire(getContactList) contacts;

    handleSelect(event) {
        // 1. Prevent default behavior of anchor tag click which is to navigate to the href url
        event.preventDefault();
        // 2. Create a custom event that bubbles. Read about event best practices at http://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.events_best_practices
        const selectEvent = new CustomEvent('contactselect', {
            detail: { contactId: event.currentTarget.dataset.contactId }
        });
        // 3. Fire the custom event
        this.dispatchEvent(selectEvent);
    }
    get errors() {
        return (this.accounts.error) ?
            reduceErrors(this.accounts.error) : [];
    }
}



contactList.html
<template>
    <template if:true={contacts.data}>
        <template if:true={errors}>
            <p>{errors}</p>
        </template>
        <template for:each={contacts.data} for:item="contact">
            <a
                href="#"
                key={contact.Id}
                data-contact-id={contact.Id}
                onclick={handleSelect}
            >
                <lightning-layout>
                    <lightning-layout-item>
                        <img src={contact.Picture__c} alt="Profile photo" />
                    </lightning-layout-item>
                    <lightning-layout-item padding="horizontal-small">
                        <p>{contact.Name}</p>
                    </lightning-layout-item>
                </lightning-layout>
            </a>
        </template>
    </template>
</template>

ContactController.cls
public with sharing class ContactController {
    @AuraEnabled(cacheable=true)
    public static List<Contact> getContactList() {
        throw new AuraHandledException('Forced error');
        /*return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WHERE Picture__c != null
            WITH SECURITY_ENFORCED
            LIMIT 10
        ];*/
    }

    @AuraEnabled(cacheable=true)
    public static List<Contact> findContacts(String searchKey) {
        String key = '%' + searchKey + '%';
        return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WHERE Name LIKE :key AND Picture__c != null
            WITH SECURITY_ENFORCED
            LIMIT 10
        ];
    }

    @AuraEnabled(cacheable=true)
    public static Contact getSingleContact() {
        return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WITH SECURITY_ENFORCED
            LIMIT 1
        ];
    }
}




But I get this error We can’t find 'reduceErrors' imported into contactList.js. Any steps I need to take here.

 
I'm (very) new to Salesforce. I'm using it with a nonprofit. We don't have Leads (most common example I found online), we have Members. My Setup does not have a Build > Leads(Members) > Fields option. I can see something similar to what other users have described by going to Platform Tools > Objects and Fields > Picklist Value Sets (or going through Object Manager to Fields & Relationships). Both lead me to the picklist I want.

I created a new picklist. It did not have an option to select which record types to apply to, but did have a box to apply to all record types. I selected it. Saved and applied. Still doesn't show for any member in that picklist category.

My picklist still doesn't show. I have set it as the default value and unset it. Neither works. 

Any other suggestions?
<!--            <ui:scrollerWrapper  class="scroll" >-->
    <aura:iteration items="{!v.commentsData}" var="comment" indexVar="key">
        <lightning:card class="{!comment.Color == 'grey' ? 'grey' : 'blue'}" aura:id="{!comment.Color}+{!key}">
            {!comment.text}
        </lightning:card>
    </aura:iteration>
    <!--    </ui:scrollerWrapper>-->
If ui:scrollerWrapper is uncommented, the class in card element does not work.
 
Hi everyone,

We have recently started using Service Cloud (Lightning) for one of our divisions. 

For another division we are currently investigating on whether it's worth moving them from Desk.com to Service Cloud as well. Unfortunately Desk.com has a nice feature with coloured labels, where in a list view you'll already see flagged up, what this case is about.

Has anyone been able to implement something similar in Service Cloud?

Formula fields won't work, as there are already lots of labels used and users are allowed to add more (similar to the Topics in Salesforce).

Just want to get an idea, of whether this is possible at all.

Thank you
Best wishes
Kathleen

User-added image

User-added image

Hi,

  I have created Managed package. And installed to another developer organization. But there could not fired some triggers in the installed environment. What the exact reason for this...

Hi all, Any hints on how to get person accounts made available?

 

From the documentation I've read it looks like I need to request it from SF directly, but for the life of me I can't seem to locate a method to make that request.

 

Thanks

-M

These links have dissapeared overnight....
I cannot find any new links, only PDF downloads.

http://www.salesforce.com/us/developer/docs/apexcode/

http://www.salesforce.com/us/developer/docs/pages/index.htm

Does anyone else use the HTML Guides?
Or do you use the PDF Downloadable Guides?
If you use the PDF guides, why do you prefer them?
I have preferred the HTML due to the search returning more relevant results. But maybe I could use the PDF search better?