• Dave Gelinas
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hello,

I'm trying to send a simple HTTP Post from Salesforce to a PowerAutomate Flow that is setup. I think I'm struggling with authenticating but the JSON being passed is OK. Not really sure as I'm new to APEX. The PowerAutomate developer provided a long URL for Azure which had some authentication variables such as sig. I remove those from the endpoint URL and put them into the body along with the expect data which is the OpportunityID. 

I also add the Azure endpoint URL to the Remote Site settings in Salesforce. Do I need to add named credentials as well? if so, what type? 

Here's the HTTP Post APEX. I when I execute which I've been doing from the Execute Anonymous Window, I get a 400 error.
 
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://prod-999.westus.logic.azure.com:443/workflows/9999999999/triggers/manual/paths/invoke');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{"api-version":"2016-06-01","sp":"/triggers/manual/run", "sv":"1.0","sig":"ABCDEFGHIJKLMNOP","OpportunityID":"0062E00001Oa8GcQAJ"}');
HttpResponse response = http.send(request);
// Parse the JSON response
if(response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
} else {
    System.debug(response.getBody());
}

Here's the expected PowerAutomate schema which also provided the endpoint URL and URL parameters as I noted above. 

User-added image
I was hoping that the Winter Release 2021 feature in Flows that handle delete events would be better implemented but turns out it doesn't work yet for the Opportunity Product standard object in addition to many other standard objects.

Scenario:
I have a custom object "Project Roles" that generates records whenever a new Opportunity Product record is created. Thus the "Project Roles" record will also contain a field that indicates the Opportunity Product record ID it was spawned from.

What I need help with: When the Opportunity Record is deleted, the matching record in project roles should also be deleted. Seems simple but I don't have any APEX experience. Any help would be appreciated. 
Hello everyone,

I'm new to custom development for Salesforce so I would really appreciate any help. I have built a working flow that updates an opportunity record. I then followed these instructions to build a custom component so that I can show a module containing any paused interviews. https://help.salesforce.com/articleView?id=flow_pause_cmp_record.htm&type=5

I would like to have this module improved so that it doesn't delete the Paused Interview if I close it out. I only want the Paused Interview to disappear if a user completes the interview. Right now, this module will delete it complete if I close out the overlay not matter where I am within my 4 page Wizard flow. 

Thank you!
I was hoping that the Winter Release 2021 feature in Flows that handle delete events would be better implemented but turns out it doesn't work yet for the Opportunity Product standard object in addition to many other standard objects.

Scenario:
I have a custom object "Project Roles" that generates records whenever a new Opportunity Product record is created. Thus the "Project Roles" record will also contain a field that indicates the Opportunity Product record ID it was spawned from.

What I need help with: When the Opportunity Record is deleted, the matching record in project roles should also be deleted. Seems simple but I don't have any APEX experience. Any help would be appreciated. 
Hello everyone,

I'm new to custom development for Salesforce so I would really appreciate any help. I have built a working flow that updates an opportunity record. I then followed these instructions to build a custom component so that I can show a module containing any paused interviews. https://help.salesforce.com/articleView?id=flow_pause_cmp_record.htm&type=5

I would like to have this module improved so that it doesn't delete the Paused Interview if I close it out. I only want the Paused Interview to disappear if a user completes the interview. Right now, this module will delete it complete if I close out the overlay not matter where I am within my 4 page Wizard flow. 

Thank you!