Showing posts with label Recipes. Show all posts
Showing posts with label Recipes. Show all posts

Monday, June 21, 2021

#862 OIC Recipe - SFDC Opportunity to Fusion ERP Order

 Had a request to demo the above integration to a customer, this provided me with an excellent opportunity to try out the OIC recipe - 
























As you can see, I need to configure the SFDC and ERP connections to point to my instances of those apps. So I replace the SFDC connection with mine - 







same with Fusion ERP - 








There is some documentation available for this recipe - just click here 


SFDC Opportunity to Fusion ERP Order

Let's take a look at the integration itself -





Let's take a look at the scope - 














The high level flow is as follows -

Opportunity won event in SFDC triggers an invoke of the OIC integration. The Opportunity object contains a custom field to hold the Fusion ERP Order Id. This field is then checked, if already set - do nothing. If not, then - 

  • Get the relevant SFDC Account
  • Get the SFDC Opportunity Line Items
  • Get the SFDC Account contacts data
    • selling, billing addresses etc.
  • Create the Order in Fusion ERP
If there is an error thrown when inserting the order, then re-open the Opportunity.

If insert is successful - update the SFDC Opportunity object custom field with the newly created order id from Fusion ERP.

Pre-Requisites

A couple of pre-reqs here - Firstly, there needs to be a synchronisation between SFDC Account and Fusion ERP Customer/Account. This requires a custom field in the SFDC Account object for the Fusion ERP customer id.

Secondly, there needs to be a synchronisation between SFDC Opportunity and Fusion ERP Order. This leverages a custom field in SFDC Account object for the Fusion ERP Order id.

Thirdly, we also need a synchronisation for Products between SFDC and Fusion ERP.

Net, net, 3 custom fields are required, along with an Outbound Message and Workflow Rule, to invoke OIC with the won opportunity details.

Let's address these -

Add Custom Fields to Opportunity and Account Objects
 
The custom field name for Opportunity, used in the recipe, is ERPOrderId__c.
I create a field with this name in the SFDC Opportunity object - 



 










 

 







Note the checked boxes -

















Now to add the custom field - ERPCustomerId__c field to  the SFDC Account object.











Now to add the custom field product2.ERPID__c.

I add this to Product - 









Ok, the 3 custom fields are available in SFDC. I have made then visible in the UI.

Now let's look at my demo account, product etc.

Firstly in SFDC - My Account - 










Note the ERPCustomerId value - 300000221386141

My Product - 












Note the ERPID = AS65003

An Opportunity - 













Here are the Fusion ERP equivalents - 









I used the following SOAP invoke to retrieve the customer id - 

















The Product/Item I am using - 









For those who remember what they read - yes, the product in SFDC is called Gen Watt Diesel 10kW.
I really should create the same product in SFDC will do, I promise.  

So we have seen that product and customer are synced, now to invoking OIC from SFDC.

Create Opportunity Outbound Message and Workflow Rule

Here I need an outbound message which will be sent to OIC, in this case, the newly won Opportunity object. I also need a workflow rule, which defines when to send the message. I have covered these in detail in the following post

So here, just the basics -






























I save the outbound wsdl for use in OIC - 












Create the Workflow Rule

















































































Amending the Recipe 

The only requirement is to edit the SFDC trigger and import the wsdl.



 









That's it - now to a test!

Testing the Recipe

I create a new Opportunity in SFDC - 

























I add a Product to the Opportunity -
























Now over to OIC Monitoring - 












I check the Activity Stream - 




















Back in SFDC - ERPOrderID has been set in the Opportunity.





















Monday, May 10, 2021

#852 OIC May 21 Release New Features - New Recipes - FTP to Netsuite File Cabinet

The May 21 release includes many new recipes - let's look at some of them - today - FTP to Netsuite File Cabinet. 



The use case here is very simple - I have files on an ftp server that need to be copied to a folder in the Netsuite File Cabinet. Many customers need to upload files, attach them to records and then organize them in the Netsuite File Cabinet. The example here, again, is very simple - but does provide the basis for more complex implementations.

The recipe is contained in the following package -   








The only pre-requisites for this recipe are -

  • FTP connection in OIC
  • Netsuite connection in OIC
  • Target folder created in the Netsuite File Cabinet
I have all the pre-reqs - my connections are called AA-FTP and AA-Netsuite.

My Netsuite connection uses the following wsdl url - it is important to use the v2019_1 version of the wsdl.










Once I import the recipe, I can start configuring - 









Step 1 - update the ftp and netsuite connections

This is very easy using the OIC Configuration editor - 

all I need to do is click the Replace icon.
























So now let's look at the integration itself - 






Rudimentary error handling has also been implemented - 







Simple enough - gets the file from an ftp directory via the OIC ftp adapter.

Here is my ftp directory - 





The name of the directory/file is set as follows -











So let's look at the Integration Properties - 








I set the ftp directory value accordingly -





Now to the internalId value - this is the internal id of my Netsuite File Cabinet.










I created a new folder - id = 801








I update the relevant integration property with this value - 

That was it - I now copy a couple of files to the ftp directory -


 










I then activate and test the integration and see the following error -











Ok, so the role is specified in the Netsuite connection definition also needs this permission - so back to Netsuite - 


 

I re-test and then check the file cabinet in Netsuite - 







Now let's look at some other interesting fields, when creating the file -




















attachFrom - valid values are _computer (for local files) or _web 

isPrivate - If you want to be the only person 
isOnline - If you want the file to be accessible externally - file will be accessible via an url.
owner - The owner of the file is a RecordRef , i.e. points to a Netsuite business object - 


 












I augment the recipe, by adding an explicit call to Netsuite in order to attach the file to my customer -






Here is the target payload for the Attach Invoke -

I will use the following customer - id - 16987








The File internal id source field - 







I delete the 2 files from the File Cabinet and re-test, then validate in Netsuite -
File have been attached to the customer.