Link to steen.hansen/blog/2016/09/06/enabling-c4c-utility-web-service-call-to-is-u-erp--part-2.
Last part is now to implement the call to the service.
The idea is to call the web service at the event 'Before Save'. Here we will call the web service with the data entered. Wait for the return of the id's from the IS-U system and then save this in our Business Object.
In the SDK go to our Business Object, right click and select 'Create Script Files'.
Then we get a list of events. The event we will use is the 'BeforeSave' event. Click 'OK'.
This will open the editor, and here is the code I entered.
(1) - creating 2 variables, one for the request we will send and one for the reponse. The CO_WEBSERVICE_2 is the one just created, and using auto complishion (CTRL + SPACE BAR) it will automatically suggest the interface and then also the request/response.
(2) - adding the fields entered on the view to the request variable.
(3) - calling the service and setting the respose variable = the result. OBS: The 'CO_PR_WEBSERVICE_2' is the name of the communication Arrangement we created in an earlier step.
(4) - adding the response from the call to our BO.
(5) - writing a message to the user, with the ID's of the objects just created in IS-U.
Now save and activate this.
Let's test this with a user in C4C.
First we will assign the Workcenter that is automatically available in C4C based on the Business Object we created for this implementation.
Logging on with the user where this is assigned to, we have the new work center assigned.
When we open this we have an empty list - then click on 'New'.
The create view opens, and we can enter some sample data.
Then click 'Save'.
At the bottom of the screen we see the sucess message:
SO WE MADE IT ALL THE WAY --- :smile: :lol: :cool:
As stated in the beginning, this is not pretty but it is ALL the steps from IS-U, PI to C4C.