0

We have a unique scenario where guests can create/submit Applications. Someone on the backend creates a Token object that contains the link to the public portal that the guest uses to create/submit an Application, and emails said link to the guest. This token has an isActive flag so after a guest submits their application(s) we can set that isActive flag to false to essentially kill the link (if they try and access the link after isActive = false, they are routed to an error page).

Usually, internal users are associated with Applications they have created/submitted so its easy to keep track what Applications belong to which users, but since these are now guests there is no one-to-many relationship like we have with internal users.

Each Token object created has a unique name (Api name of "Name") that I have added as a field (Token Name) to the Applications object so now whenever a guest creates an application by using a link from a Token object, said Token object's name (ex. ATR - 8374) is added to the Application on insert. Basically creating a one-to-many relationship between a Token and the Application(s) it might have associated with it.

Since the guest may have more than one application to create/submit and the difficulty to update records as a guest user to begin with, I would like to use a workflow rule to handle the setting the IsActive flag on the Token object to false. Basically, the criteria is if all Applications with the same Token Name (ex. ATR - 8374) have a Status of 'Submitted' then look back up to the Token with the same Name (i.e. Token Name from Applications__c = Name from Token__c) and set the isActive flag on said Token object to false.

Is there a way in Workflow rules or maybe in another declarative approach in Salesforce to cross reference another object's fields? The main object in this workflow rule will be the Token object were we will be referencing the Name and isActive field, and we will be cross referencing the Status field and Token Name field from the Application object.

0

You can't do this with a Workflow Rule. You will need to build either a Flow or an Apex trigger in order to be able to

  1. React to changes on the Application object.
  2. Query for other Application objects with the same Token Name.
  3. Verify their statuses.
  4. Query for and update a related Token.
1
  • Thank you. I will try a flow first and turn to code as a last resort – Diego Delgado May 15 at 19:47

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.