2

I am trying to update workflow email alerts via Tooling API, My request is:

req.setBody('{"fullName": "Test","Metadata": {"description": "Updated via WorkBench"}}');

As "Only the Metadata and FullName fields may be specified on ActionEmail".

But without the other fields like Template ID etc the request is not getting created with error:

Mandatory fields are missing

And if we tend to add those fields, we get the same error stated above. Does anyone have any idea or sample code on this please?

Thanks

1 Answer 1

0

If you create workflowalert within salesforce UI and then pull it, you could see Json body example.

GET /tooling/sobjects/WorkflowAlert/{id}

In your example, first error is:

"message": "Required field is missing: template"

But we could see same field in metadata. I went step by step through errors and got next Json for update call:

{
    "Metadata": {
        "senderType": "CurrentUser",
        "description": "Updated via WorkBench",
        "template": "unfiled$public/MarketingProductInquiryResponse",
        "recipients": [{
            "field": null,
            "recipient": "xxx@xxx.com",
            "type": "user"
        }]
    }
}

Where template should be valid name, sendertype - valid picklist value etc. If you send patch, you should get http 204 and updated record in SF.

PATCH /tooling/sobjects/WorkflowAlert/{Id}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.