Skip to main content

Video tutorial

Written instructions

Before you begin

  1. Gather the necessary information. You will need:
  • The authentication header: “medizues-api-key”
  • Your MediZues API Key – this is unique to your account. You can find it in your account tab under User Info
  • Your folder’s webhook URL destination – you can find this by clicking on the paper airplane symbol next to the folder name
  • The following Salesforce formula: right(text({!$Record.Birthdate}),2)&”-“&mid(text({!$Record.Birthdate}),6,2)&”-“&left(text({!$Record.Birthdate}),4)
  • The following data schema:

{

“DOB”:”01-01-1989″,

“MBI”:”1234567890″

}

  1. Ensure you have a custom field on the contact in Salesforce that stores the MBI information

 

Credentials

  1. First, we need to create an external credential, a named credential, and a principal.
  2. Navigate to the named credential settings in Salesforce setup
  3. Click on “External Credentials” and then click “New”
  4. Choose a unique label and name and set the authentication to custom. Then click “Save”.
  5. Scroll down to the principals section and click “New”
  6. Choose a name and click “Save”. Note: do not add the API key as an authentication parameter, it will not work.
  7. Scroll down to the custom headers section and click “New”
  8. Set the name to “medizues-api-key” and the value to your API key. Then click “Save”.
  9. Navigate back to your named credential settings, and under named credentials select “New”.
  10. Choose a unique label and name, then ensure it is enabled for callouts, and set the URL to your folder URL
  11. Under the authentication section when creating the credential, find the external credential field and search for the external credential you created in step 4. Click “Save”.
  12. Navigate to your permission set settings in Salesforce setup. Select “New”. Choose a label and click “Save”.
  13. Within the permission set overview for your new set, click on “External Credential Principal Access”. Then add the principal you created in step 5.
  14. Click on “Manage Assignments”. Assign the permission set to the user that will be creating the flow.

Building the Flow

  1. Navigate to flows in Salesforce setup
  2. Create a new flow. Select the trigger that best suits your use case
  3. For my example, I will use a record-triggered flow. I will create this as a contact flow and I will set it to run when a contact is created or updated.
  4. Set your entry criteria. I used when MBI or birth date has changed and both MBI and birth date are not null using custom condition logic. You could use a formula here if you are more comfortable with that.
  5. At the very bottom of your start settings click the checkbox to create an asynchronous path
  6. In the asynchronous path select add element and then choose action
  7. Scroll to the bottom of the list of action types and select create HTTP callout
  8. Give the callout a unique name and select the named credential you created in step 10. Click “Next”.
  9. Give the action a label and select POST as the method. Optionally you can add a description. Click “Next”.
    • If you chose to only include the org id and not the folder id in step 10a, this is where you insert the folder ID as the URL path. Otherwise leave this blank
  10. Add the schema listed in the Before You Begin section to the sample JSON request box. Click “Review”. Ensure both DOB and MBI are string variables. Click “Next”.
  11. Click “Use Example Response” and paste the schema into the same JSON box again. Click “Review” and then click “Save” again.
  12. Choose a label for your action. For the request body select “New Resource”. Give the resource a name and make it available for inputs and outputs. Click “Done”.
  13. Click “Done” again.
  14. Because the way Salesforce formats dates does not match the way MediZues accepts dates you will need to create a formula field on the object or use a formula variable in the flow.
  15. In the toolbox sidebar, on the right side of the flow builder, select “New Resource” and use the formula type.
  16. Give the variable a name and then select text as the data format. In the formula builder paste the formula included in the Before You Begin section.
    • If you are using a custom field or a different object than contact, you may have to change the name of the field within the formula
  17. Between the action and the start on the run asynchronously path click the plus button. Use the assignment element this time.
  18. Choose a label. For the first variable click into the search box and then click on the apex defined variable you created in step 12. Select DOB, then add an assignment and add MBI using the same process.
  19. Set DOB to equal your formula element (or formula field if using) and MBI to equal the MBI field on the contact. You can find it under global variables by selecting record and then the field name.
  20. Click “Save” at the top right hand corner and give your flow a name.
  21. You can test by clicking “Debug”, choosing the asynchronous path, selecting a test record and modifying it to meet the entry criteria.
  22. If you get a response code of 200, you are ready to go! Activate the flow.

Resources

MediZues –> SF

Coming soon…