0

I am migrating an existing Mule 3 application to Mule 4

Mule 3 is making an APEX GET call and passing a path param / uri param as well as a query param

Here is the source code for Mule 3:

<sfdc:invoke-apex-rest-method config-ref="SFDC_config" 
restMethodName="EmpMaintenanceDetails||getEmpMaintenanceDetails^/services/apexrest/EmpMaintenanceDetails/
#[flowVars.empId]?id=#[flowVars.empId]^HttpGet^application/json^" doc:name="Salesforce: EmpMaintenanceDetails"/>

So here flowVars.empId is the path param and id=#[flowVars.empId] is the same value passes as a query param

In case of Mule 4 I was able to pass the query param in dataweave:

<ee:transform doc:name="set empId as query param" >
<ee:message >
    <ee:set-payload >
        <![CDATA[%dw 2.0
            output application/json
            ---
            {
                queryParams:{
                    id: message.attributes.uriParams.'empId'
                }
            }]]>
    </ee:set-payload>
</ee:message>
</ee:transform>

However I am not sure how to pass the path / uri param ?

In case of Mule 4 in anypoint studio the method name is auto populated so this is the code I have for Mule 4 :

<salesforce:invoke-apex-rest-method doc:name="SF EmpMaintenanceDetails GET call" 
config-ref="SFDC_config" className="EmpMaintenanceDetails"
methodName="getEmpMaintenanceDetails^/EmpMaintenanceDetails/*^HttpGet^void^" />

2 Answers 2

0

You can replace EmpMaintenanceDetails/* in the method name with a data weave expression to get the variable:

EmpMaintenanceDetails/#[vars.empId]

I think the auto population just adds a wildcard for the uri param by default.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use this :

"getEmpMaintenanceDetails^/EmpMaintenanceDetails/" ++ attributes.uriParams.empId ++ "^HttpGet^void^"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.