Skip to main content

Hello,  I have a question about junction objects and flows to them.  I have built a junction object: Example:   Devices ----->> Equipment output <<----- Users.  

- Devices: Owns devices information. 

- Equipment output: Possesses information such as issue date and return date of the equipment. 

- User: In which only the user of the device is stored.  

 

Now I want to implement some logic to this in flows and ask if this works: 

1. i want that when i create an equipment output and i add a device a check takes place to see if there is already a return date for this device in the object equipment output. Is this possible to implement in flows?    

 

2. it should be calculated from the equipment output object if a device is already borrowed. Criteria: - If no equipment output exists for the respective device = no - If all equipment outputs have maintained a return date = no - If there is an equipment output without maintained return date = yes. Is this possible to implement in flows?    

 

regards, Alex

#flow
4 réponses
  1. 7 févr. 2022, 19:01

    Hello Alex,

     

    Before I start talking about your use cases, I assume that you have some unique identifier for your devices other than Salesforce Id. It would be much easier to track and communicate with the users. Also, I assume that you have picklist value where you specify what kind of equipment output of any equipment output is whether it is a Returned, Issued, Expecting a return etc.

     

    Use Case 1:

     

    Before you start to this flow, you need to create a checkbox on the Equipment Output object and create a validation rule with the condition of newlyCreatedCheckbox equal true. Then, you need a before save record triggered flow upon creation on Equipment Output object. I assume the relationship is a master-detail so you do not have to check for the null values.

     

    Place a get element to get if there was any return equipment output for this user and device. You can use the following conditions to get them: 

     

    User equals Record.User

    Device equals Record.Device

    Action equals Expecting a return

     

    You need to place a decision element where you need to check if the get element is null or not, if it is NOT null, simply set the newly created checkbox to true to trigger the validation rule. In this way, you will know that there is already a equipment output for the same User and Device.

     

    Use Case 2:

     

    You can keep track of a device return with a checkbox in this use case and I think it would less complicated. The name of the checkbox can be is Borrowed for example, in this way you can understand whether it is borrowed or not without checking if it exists in equipment output or if it has a maintained a return date.

     

    You need to only allow creation only if the related device's borrowed checkbox is set to false and you need to set the borrowed checkbox to false when a new equipment output with return action is created.

     

    This use case is a tricky but if you have any question please do not hesitate to ask.

0/9000