Skip to main content

#Salesforce_Mobile_App토론 중인 항목 4개

Programmatically Approving/Rejecting Flow Orchestration Approval Steps (and why ConnectApi.FlowApprovalProcesses won't work)

 

The problem

If you're using Flow Orchestration with Approval Steps and need to let users approve or reject work items from somewhere other than the standard Work Guide component — for example, from a custom mobile experience, since Work Guide does not render in the Salesforce mobile app despite showing up fine in Lightning App Builder's phone preview — you'll hit a wall pretty fast.

Here's what doesn't work, and why, so you don't have to burn the hours we did finding out:

Dead end #1: ConnectApi.FlowApprovalProcesses.getFlowApprovalProcessWithStatus()

This looks like exactly the right API — it's documented specifically for retrieving the status and available actions of a flow approval process. In practice, for Orchestration-embedded Approval Steps specifically (as opposed to standalone autolaunched Flow Approval Processes invoked via a "Request an Approval" flow element), we found:

  • Calling it via Apex throws ConnectApi.ConnectApiException: Id=null when passed the Flow API name for processNames
  • Calling the identical request via raw REST (same org, same inputs) succeeds and returns correct data — ruling out an Apex-only bug
  • When it does succeed, it consistently returns isApprovalInProgress: true but only exposes a "Recall" action — never Approve/Reject, even when querying as the actual assigned approver, not the submitter

We filed this with Salesforce Support and it's now a tracked Known Issue: W-23702762. Support confirmed this API path does not currently support returning Approve/Reject actions for Orchestration Approval Steps.

Dead end #2: Classic Approval.process()

The older, well-documented Approval.ProcessWorkitemRequest / Approval.process() Apex API only works against classic ProcessInstanceWorkitem records. Flow Orchestration Approval Steps create ApprovalWorkItem records instead — a different object entirely. Attempting to use the classic API against an ApprovalWorkItem Id throws INVALID_CROSS_REFERENCE_KEY.

The actual solution: reviewApprovalWorkItem

There's a standard invocable action — not prominently linked from the API you'd naturally start with — that does exactly what's needed:

  • Action name: reviewApprovalWorkItem
  • Inputs: approvalWorkItemId (String), approvalDecision (String — must be exactly "Approve" or "Reject", capitalized), comments (String, optional)
  • Preconditions: the work item's Status must be Assigned, and the calling user must be the assignee (or a delegate, or hold a higher role)

Calling it from Apex:

apex

Invocable.Action action = Invocable.Action.createStandardAction('reviewApprovalWorkItem');

action.setInvocationParameter('approvalWorkItemId', workItemId);

action.setInvocationParameter('approvalDecision', 'Approve'); // or 'Reject' — exact capitalization required

action.setInvocationParameter('comments', 'Optional comment text');

List<Invocable.Action.Result> results = action.invoke();

Boolean success = results[0].isSuccess();

We found the documentation for this action almost by accident, linked from the "Recall Approval Submission Action" doc page — it's filed under Salesforce's "Advanced Approvals Standard Invocable Actions" documentation, not anywhere near the ConnectApi Orchestration docs where we were originally looking.

The gotcha that will still bite you: field update sequencing

Getting reviewApprovalWorkItem working is not the end of the story. If your orchestration has logic downstream of the approval step — for example, a Decision element that checks a field on the related record (like "does this need Finance approval next?") to determine routing — that field must already reflect the correct value before you call reviewApprovalWorkItem, not after.

Why: the native Work Guide component's "Approve" button doesn't just mark the work item complete — it runs the entire underlying subflow tied to that approval step (in our case, a subflow that included a Decision element, a field update on the related record, and a Slack notification, all before marking the work item done). When you call reviewApprovalWorkItem directly, you bypass all of that subflow logic and only get the equivalent of "mark this work item done." Any Orchestration Decision element gated on your related record's fields will evaluate immediately once the work item is marked complete — using whatever the field's value is at that exact moment, which may still be stale if you haven't updated it yourself first.

Concretely, for us this meant:

apex

// WRONG ORDER — orchestration's Decision evaluates before the field is updated

Invocable.Action action = Invocable.Action.createStandardAction('reviewApprovalWorkItem');

// ...invoke...

opp.Approval_Status__c = 'Pending Finance Approval'; // too late — Decision already ran

update opp;

apex

// CORRECT ORDER

opp.Approval_Status__c = 'Pending Finance Approval'; // set first

update opp;

Invocable.Action action = Invocable.Action.createStandardAction('reviewApprovalWorkItem');

// ...invoke — Decision now evaluates the correct, already-updated value

We only caught this because the orchestration instance showed Status: Completed (successfully!) but the expected next-stage work item never got created — it took querying the FlowOrchestrationInstance and reading the underlying subflow's Decision logic directly to figure out why.

If your orchestration's subflow also sends notifications (Slack, email) as part of that same subflow logic, be aware those will also be skipped when you bypass the subflow via reviewApprovalWorkItem directly — you'll need to replicate any such notification yourself (as a Flow Action or Apex callout) alongside the field update.

Summary checklist if you're building this yourself

  1. Don't use ConnectApi.FlowApprovalProcesses for Orchestration Approval Steps — it's a known, tracked bug (W-23702762) for retrieving Approve/Reject actions.
  2. Don't use classic Approval.process() — wrong object type entirely.
  3. Do use the standard invocable action reviewApprovalWorkItem, called via Invocable.Action.createStandardAction().
  4. Capitalize approvalDecision exactly as "Approve" or "Reject".
  5. Update any fields your orchestration's downstream Decision logic depends on before calling reviewApprovalWorkItem, not after.
  6. Check whether your approval step's native subflow sends any notifications (Slack/email) as part of its own logic — if so, replicate that separately, since bypassing the subflow means bypassing those too.

Hope this saves someone the hours it cost us to piece together!!!

 

#Flow-Orchestration  #Advanced Approvals  #Salesforce_Mobile_App

0/9000

Hey all, 

We are running into issues accessing the mobile app since MFA has been enforced for privileged users. 

  1. If a user sets up the Built-in Authentication on desktop, they are not able to login to mobile. Our company only allows Windows Hello authentication on desktop, and users are unable to "Verify Identity" in iOS when this is added on desktop. The screen is frozen on this even when using "Login for Admin."
  2. We have gone into Salesforce Classic on the mobile browser and added a passkey, but it doesn't work in the app. 
  3. If we delete the Built-in Authenticator on desktop and add a passkey for mobile, it then requires users to have their phones to login on desktop. 

None of these scenarios are ideal, and I'm wondering if anyone has been able to use Window Hello to authenticate desktop and then directly login on mobile with the their Face ID, Touch ID, or passcode? We have found hacky ways to get people logged in with generating a temporary code then having them setup a passkey etc, but it seems like the app should automatically guide users to setup a mobile passkey even when there's an authenticator for desktop? Is this a bug with MFA and mobile because it doesn't seem like this should be expected behavior? 

 

#Multi-Factor-Authentication  #Salesforce1 Mobile App  #Salesforce_Mobile_App

답변 2개
  1. 8월 7일 오후 3:40

    @Tushar Jadav

    none of those links provide the answer if you have read it. People have authenticity to read, analyze and guide. Either you haven't read the question or you are just spamming, please stop.  

     

    @Whitney Pierce Takaba We couldn't find a solution to this problem as well, removing built-in authenticator and enabling Salesforce MFA is the only way currently, which also have it's own bug of forwarding to Salesforce MFA after a weak AMR signal of SSO. If someone has a proper solution, we'll be happy to hear. 

0/9000

I have created an LWC component which uses record-edit from. I have added this component in Aura App and called this aura app in VF page. Ihave called this vf page in list view button.

Now through this list view button is placed on opportunity page. In desktop mode i am able to use look fields ie. related account to an opportunity and create new records. But in salesforce mobile app, i am unable to use lookup filed ie related account in opportunity while creating new records using this list view button. So is lookup field not supported in salesforce mobile? Or is there any alternative.

#Salesforce_Mobile_App #Lookup Relationships

 

#Mobile Application Salesforce #Salesforce 

답변 1개
  1. Manoj Nambirajan (Dell Technologies) Forum Ambassador
    2024년 2월 16일 오전 7:20
0/9000