SOLVED

Re: Unable to see Enable for Email Scripting for my Salesforce Custom Object

Go to solution
AdeleBriggs
Level 2

I have synced the scheme for a Salesforce custom object, and I have set up some velocity scripts to pull through the data into an email. The problem I have is the data isn't pulling through. It appears the script is correct, so the suggestion has been to make sure the following is enabled:

 

Enable for Email Scripting and Show in Person Detail:

  • In the Salesforce Object Sync section, make sure that the following settings are enabled:

    • Enable for Email Scripting (This is critical for your Velocity script to work)

    • Show in Person Detail (This ensures the object is visible in the person's record)

 

 

The problem I have, is that I don't see these options in the customer object.

It looks like I am still on a legacy sync, so I don't know how to solve this.

Does anyone know how I can enable these two options for this custom object. 

I am under some time constraints. EEEK.

Thanking you in advance.

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

Hi, remember to highlight any code using the syntax highlighter so it’s readable. I edited your post this time.

 

It’s impossible to say if your code is “correct” given that we don’t know what you’re trying to do (arbitrarily seeking the first item in the list is typically not what you want to do).

 

Have you checked off the fields in the tree on the right-hand side of Script Editor? Can you show a screenshot of where you’ve done that?

 

If you’ve done that and dragged one of the fields to the canvas (left-hand side) and it’s shown the list name as  $Commerce_Request__clist, then you should start by dumping the entire list like this:

${Commerce_Request__clist}

 

No reason to start by looping over the list, just dump the list and then go deeper.

View solution in original post

5 REPLIES 5
AdeleBriggs
Level 2

It is being suggested that I would not see these options 

 

this is my velocity coding 

#if( $Commerce_Request__clist.size() > 0 )
#set( $request = $Commerce_Request__clist.get(0) )
${request.CreatedDate}
#else
No request found.
#end

 

when I preview the email for the person record with the custom object it is saying : No request found.

SanfordWhiteman
Level 10 - Community Moderator

Hi, remember to highlight any code using the syntax highlighter so it’s readable. I edited your post this time.

 

It’s impossible to say if your code is “correct” given that we don’t know what you’re trying to do (arbitrarily seeking the first item in the list is typically not what you want to do).

 

Have you checked off the fields in the tree on the right-hand side of Script Editor? Can you show a screenshot of where you’ve done that?

 

If you’ve done that and dragged one of the fields to the canvas (left-hand side) and it’s shown the list name as  $Commerce_Request__clist, then you should start by dumping the entire list like this:

${Commerce_Request__clist}

 

No reason to start by looping over the list, just dump the list and then go deeper.

AdeleBriggs
Level 2

thank you for highlighting the code.

 

I managed to get the code to work. I had not included the suffix of the field name [__c]

 

I have not really experimented with the velocity code, and because of an urgent requirement to complete an email I was trying my best.

 

SanfordWhiteman
Level 10 - Community Moderator

OK. Still, arbitrarily seeking the first item in a list of Custom Objects is an error 99.9% of the time. That’s a sign that the code will break later, even if it appears to work now. But without knowing the reqts we can’t say how to improve it!

AdeleBriggs
Level 2

My salesforce admin has just commented that

 

the lookup fields are on the custom object to the Opp & Contact 

 

But the Opp & Contact doesn't have a lookup back to the custom object 

 

Could this stop the velocity script from pulling through to the email for that Person?