How to parametize POST request on Salesforce Apex REST

On a standard POST call to a REST endpoint. The receiving endpoint expects a payload on the body of the POST. The service then parses the content of the body.

For example on the following Salesforce endpoint

https://integration-architect-dev-ed.lightning.force.com/apexrest/MyService

I created a POST request and sent on the body the following JSON:

{“companyName”:”GenePoint”,”caseType”:”Software”}

With Apex REST here are two ways you can create your REST POST service method

  • Create the method and supply the parameters for the function. Salesforce Apex REST will attempt to deserialize the payload data into those parameters.

Note: With this method passing the following XML payload will also work.

Consider the following when choosing which method to implement

  • If payload is easy and won’t change – method with parameters.
  • Do you have accept both JSON and XML payload – method parameters
  • For complex payload structure – method with User-defined type payload or the json String payload

Resource:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm

Salesforce List Custom Settings is Greyed Out

Just ran into this when I was creating a new Custom Setting for a new org. The List Settings Type was greyed out.

Found out this is something new for Spring 18. It is now an application level settings that needs to be enabled even for System Administrators.

Starting with the Spring ’18 release, Admins have the ability to control the List type Custom Setting creation. By default, the “Manage List Custom Settings Type” is disabled, which is why Custom Setting type List is greyed out. To allow the creation of custom settings when using application-level data definitions you’ll need to enable Manage List Custom Settings Type.

To enable do the following:
Go to Setup > Data > Schema Settings and toggle button to enable “Manage List Custom Settings Type”

Then go back to Custom Settings.

Resolve ANT with Dollar Signs ($$) on Variables

Quick little tip. On my Ant deployment script for Salesforce I run into an issue where my password which was assigned to a variable contained double dollar sign characters. Ant would by default strip out any string with ‘$$’ sign into ‘$’ because it was expecting a value.

This caused my password to stop working.

I ended up breaking my password into two variables.

from

sf.password = time$$machine

to

sf.password = time$

sf.password2 = machine

Then on my build.xml file, I created a new property to store the dollar value and updated the passwordToken property.

<property name="dollar" value="$" />
<property name="passwordToken" value="${sf.password}${dollar}{sf.password2}${sf.token}"/>

That is the post for the day.

How To Create A Profile Map for Custom SOQL in Boomi Salesforce Connector

Been working on Boomi platform for couple months now and here to share a quick tip that I learned earlier. Since Boomi now support Custom SOQL for an operation it however looses the XML profile when you import an object.

The profile can easily be fixed by doing the following.

  1. Add a Message shape and add your SOQL
  2. Add Salesforce Connector
  3. Add an Operation and click on Advanced link and choose Custom SOQL
  4. Save and run the process
  5. Inspect the logs and copy the xml and save it as a file
  6. Create a new mapping shape
  7. On the Left mapping click on Choose
  8. On Profile type select XML and choose Create New Profile
  9. Click on Import Profile
  10. Select your saved file and you are set.

 

Here is how my process looks like.

 

Give it a try!

 

Passed the Identity & Access Management Designer Certification (Achieved System Architect)

Just passed my last required certification which is the Identity and Access Management Designer to finally become Salesforce Certified System Architect. What a journey and accomplishment. My study method seems to be working and would like to share my methods and notes.

The method :
At the start of the 2nd part of thIs year(2018) I made a goal to start the Technical Architect journey and get certified every month . The method I’ve been doing is really easy, I book a date one month in advance and spend at least an hour or two reading the materials I need. I use a technique called Pomodoro using an online tool kanbanflow.com and concentrate on learning a concept. I try to do this at least everyday either before bed or if I missed it for that evening I try to get up early in the morning. So far this has worked great for me as this made me consistent.

Exam takeaways
Now about the Identity and Access Management exam. This is like the rest of the exam which is 60 + 5 extra multiple choice question. You are given 120 minutes and passing is 65%.
Honestly this was a hard exam. Best if you have done implementation of it. I wasn’t that confident I would pass the exam when I hit the Submit button.

Trailhead: Identity and Access Management Designer
Go over this trialmix and nail down it to 100%. – https://trailhead.salesforce.com/users/00550000006yDdKAAU/trailmixes/architect-identity-and-access-management

Authentication and Authorisation – basically who you are (credentials) and what you are allowed to do
Different OAuth Flows:
  • User Agent Flow
  • Web Server Flow
  • JWT Bearer Token Flow
Idp and SP Initiated Flow
  • Heaps of questions on IDP initiated and SP Initiated Flow (3-4)
  • Idp Initiated SAML is when from the IDP system you are trying to access the system enabled for SSO
  • SP Initiated SAML is when you are coming from the service provider and asking authorization from the Idp.
  • Which SSO flow can be used for deep Linking
  • Use of Entity Id and Login URLs
Connected App and Managing Policies
  • Different types of scopes for OAuth and when to use them
  • Refresh Token Policy
  • User Provisioning – keeping users in sync
  • Custom Connected App Handler
2 Factor Authentication and Login Flows
  • When to use 2 factor and how login flows can be used for different scenarios
SSO Settings and My Domain
  • JIT User Provisioning
  • Login
  • Auth Providers
Federated SSO
Delegated SSO
Social SSO
Security
  • Login IP ranges
  • Trusted IP uses
Canvass Apps
Identity Connect
App Launcher
Auth Provider Setup
Active Directory
I’ll continue to enrich this post as I recall some of the other stuffs.