cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically approving Time and Material Entries in SAP Field Service Management

Josh_OI
Newcomer
0 Kudos
167

Hi all,

We are in the process of implementing SAP Service Cloud and Field Service Management. We are trying to figure out how to automatically approve efforts, mileage, etc. So in summary of what we are trying to achieve: engineer works on a job, records their time entries, closes the job, the time entries are passed through to the Time and Material Journal, the system automatically approves the time entries. It is this last part we are struggling with regarding the automatic approval.

 

I have created the following business rule based off of another article about automatic approval on this community forum, however it does not appear to be working.

BusinessRule.png

Please could someone share how to set up a business rule that automatically approves time and material entries after the activity is closed?

 

Many thanks in advance!

 

 

View Entire Topic
zarnovickyf
Participant
0 Kudos

Hello Josh, if you want to approve TE, you need to do it via Webhook (not FSM Webhook) with credentials of "decision maker". Not sure why, but it works for me only this way.

1st action you should get these creds viac API POST https://eu.fsm.cloud.sap/api/oauth2/v1/token.

zarnovickyf_1-1731279602231.png

header Authorization = Basic token generated for you Client Id which you normally use for API (e.g. via Postman)
username = format account/user (e.g. sap_p1/user01)

password = password123 for user in username

Body of action:

${[ [ "grant_type", "password" ], [ "username", sap_p1/user01 ], [ "password", password123 ], ].map(function(e) { return e[0] + "=" + encodeURIComponent(e[1]) } ).join("&")}

 

Then in 2nd action you again call Webhook for approval object where you are setting decisionStatus, decisionDate, decisionMaker, .... In header you are user access_token from 1st action via fuction parse:

Bearer ${JSON.parse(authResponse).access_token}

zarnovickyf_2-1731280060584.png

That should do it.

Filip