I have two objects Grant contract Modification and Grant contract.Here from Grant Contract Modification I have given a master detail to grant contract and each modifications created is available in the grant contract object's related list as in the picture. Related list of Grant Contract

But here I have provided it as an auto number and the issue is that the modification when created in one Grant starts with the number 1 and when I create in another grant it starts with the number 2 instead of 1.

So I am asked to use a flow to solve this.I have used a record triggered flow and each time a Grant Contract Modification is created the flow fires and a get record is placed after that to get all the grant contracts.I am stuck now.I have to get all the Modifications inside this and it should be displayed in this format "Mod-number(1,2,3..etc)-GrantContractName for eg:Mod-01-GrantContract01.

I am planning to get the number of modifications by getting the count of records in the getrecords(If I get the number of modifications inside each grant contract) and append it to the Mod. How can I do it using a flow?

1 Answer 1


Quick solution:

  • Add a number variable resource (call it something like countContractMods)
  • Place an Assignment element after the Get.
  • On the left-hand side of the Assignment place the number variable resource you created For the assignment's operator, select "Equals Count" (this is the hidden secret sauce)
  • On the right-hand side of the Assignment, select your Get resource

Ta-da! After the Assignment element executes, your number variable will have the count of records from that Get, available for you to use downstream in the Flow for Decisions, Updates, etc.

Possibly quicker solution:

If this is a master-detail relationship, use a Rollup Summary field on the parent object to get the count of children. No Flow/Automation needed!

Longer Solution:

If this is a regular lookup relationship, Consider incorporating a rollup utility. What happens if one of the child records gets deleted? Undeleted? Is reparenting possible? What happens if multiple child records are created in one transaction? This type of problem is challenging to handle natively in Flows, but has been solved by utilities that can be incorporated with Flow Builder. Check out apex-rollup (don't be scared by apex in the name- it comes with actions that can initiate the rollup from Flows): https://github.com/jamessimone/apex-rollup

  • Thanks it worked.I am getting the number of records right now which I have stored in a variable.Now I have to concatenate this with the text field Mod and the related Grant Contract.In short if my Grant Contract is Grant Contract-033 and the number is 7 I have to display it as Mod-7-Grant Contract-033.
    – JK123
    Apr 4, 2022 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .