Friday, April 30, 2021

#844 OIC May 21 Release - New Jira adapter

 








The Hare of the Dog Pub has adopted Jira to sort out the multifarious issues it faces serving its punters.

The plan is to offer a REST api to the Hare of the Dog's mobile app developers, that will enable them to produce a state of the art UI for the drinkers of Harmonstown. This will allow customers to raise bugs against the pub.

OIC May 21 comes with a Jira adapter - so let's test this out - 

First step is to generate an API token in Jira - 





















































Now to OIC...the api token will be used as password, when defining the Jira connection. 























Now to leveraging this connection in an integration - 

This is a REST triggered orchestration, with the following request payload - 














Here is the mapping - 












Now to a simple test -








Check in Jira - 












Here's the response returned by the integration -






id is 10008

key is CLEAN-2

Let's look at the other functionality supported by the adapter -

Assign Issue 








I need to map the user id from Jira to the accountId field - 

My user's Jira userid is - included in the url below - 










I just hard code this in the OIC mapper - naturally the issue id is available in the response from Create Issue -









Test and validate in Jira - Bug has been assigned to me -






Get Users















The key again is the user accountId, I map an test - 

























































#843 OIC for File Transfer - Rename - Move to Target - Delete Source

This is a simple scenario from a customer - they need to move files generated by their ERP to OCI Object Storage. 







There are a couple of extras -

  • Source files are on an FTP Server
  • Source file names are in the format Prefix.FileName.Suffix for example - SAP001.Mahnwesen012021.mnf
  • Customer wants the file written to object storage without prefix and suffix,
  • Customer wants files deleted from FTP Server, once they have been saved to object storage
Ok, so here's my quick demo for such - 
Files on my ftp server - 




















Here is the integration - 












































So what are the steps here?

1. ListFiles - FTP Adapter --> List File operation - this will return a list of all the files to be moved.
2. For EachFile loop - 
2.1. Read the file from FTP (pass by reference)
2.2. WriteFile to Object Storage
3. Check result of WriteFile
3.1. If success (http code = 200) -- FTP Adapter -- Delete File  

I test the integration - 

























I check the ftp directory - 

























Now to the OIC configuration details - 

ListFiles - List the files in the source directory of the ftp server -

















For Each Loop configuration - 














Read File configuration - 




















Note the dummy file name. I will set this to the name of the current file -

Map to Read File configuration - 



 




WriteFile2Storage configuration - 



















Map to Write2Storage configuration - 

first step - pass file by reference -








second step - rename - 
















I do the substring magic to extract the file name without prefix and suffix - 

concat ("https://objectstorage.us-phoenix-1.oraclecloud.com/n/tenancy/b/bucket/o/", substring-before (substring-after ($currentFile/nsmpr3:File/nsmpr3:filename, "." ), "." ) )

SWITCH - check for success configuration - 





















DeleteFile - FTP connection configuration - 




















Map to DeleteFile - same modus operandi - pass file name and directory from the currentFile variable -







Monday, April 19, 2021

#842 OIC - Oracle Hospitality syncing Company/Guest with SFDC Account/Contact








I covered the very basic Oracle Hospitality to SFDC integration a couple of posts ago. Now to a more compelling example - Oracle Hospitality allows us to create profiles for companies and guests - the latter being employees of the former. So, with this background, how about syncing Oracle Hospitality company and guest profiles with SFDC Accounts and Contacts?

I start, as usual, in Postman - working out which REST apis I need to invoke -

Here is the api to create a company profile - I create one for the Hare of the Dog Pub.

Note the id returned - 17858.

I then create a Guest profile - for the Hare's general factotum - Jimmy Keenahann.


 











Note the id for Jimmy - 17860.

Now to create the relationship between the 2 -











I now update the Company Profile with address and telephone data -













I also update Jimmy's profile - 














I can now use the following api to retrieve the relationship -













With OHIP, one can create a reservation for an existing profile id -



 







Note the reservation id - 19650.

I can use this to retrieve the Reservation, which will include the profile id -














Final step - I use the following api to store Jimmy's preferences for Banquets.













So now to the integration use case - based on a reservation id 

- retrieve the guest profile

- retrieve the company 

SFDC - check if an Account exists for the OH Company - if not, create a new Account in SFDC.

SFDC - check if a Contact exists for the OH Guest -  if not, create a new Contact in SFDC, linked to the relevant Account.

So let's build this incrementally - first step goes as far as creating the Account in SFDC -













I use the following SOQL in Check4Account - 














The SWITCH action is used to check if any records are returned - 













Now to testing...

CreateAccount returns me the SFDC Account id - 








I can check this out in SFDC - 








Note the id in the url.

Next step is to create the contact - now to save time, I won't go thru the existence check steps beforehand - you've already seen how easy it is to do that.













Check4Contact uses SOQL - checking for match on name and Contact Account Id -












The CreateContact configuration is simple - 











I only map a couple of fields - name etc. and accountId - 

Note: I am only showing the mapped fields -












Test Result in SFDC -









Now in a real life situation I could have a plethora of information coming from Oracle Hospitality e.g.













So I would probably add a couple of custom objects to my CRM to store such data. 

















I have surfaced these as the Bookings and Guest Preferences sections in the SFDC Contacts page -


 






























Bookings - could include reservation / stay data; a reservation morphing into a stay, once the guest has checked out. Sales activities with this SFDC contact can, of course, be progressed thru the standard SFDC business objects - Opportunities etc.

Naturally, I can update these custom business objects via the OIC SFDC adapter -