function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sourav PSourav P 

Taking a specific field value from one object to another

In my quote object, if a checkbox field (compulsory present) is ticked, and if the status is converted to " Transacted", I need to take some specific barcode value ( can be used only once) in each quote. I have uploaded alll the provided barcodes in another object " Compulsory Barcode".

I was thinking to accomplish it through process builder, so i created the look up field between the two object ( kept the quote as child) and created the PB in quote object. But it didnot working.

May be its not able to decide, which barcode to pick from the list ? which we may need to specify?
I did as per below in the PB,
Now i have two field in quote, the 2nd one is the look up with custom object. and the first one is a texxt field where i need to see the barcode value ( e.g 1296589765544). In below i tried to refer from quote but its only referring to the ID/Name of the custom record as a look up.

User-added image

PB step 1 on Quote object:

Criteria : 
3rd one is, i have taken from the custom object , where the field " Not used" is false.( not ticked)
User-added image
Action :
Now i have to fill the look up field as well, else the other text field will not come. So, the reference ( 1st one) i got only record ID, in teh second , i refer to teh barcode value from the custom object.

User-added image
But , its not giving me any result. How it will decide whch record from the custom object it has to pick ? plz suggest
Now if i , manually filling the look up field, the barcode is coming through PB, but how to choose and update the look up field by PB ? thnx

User-added image

Ankit Maheshwari 2Ankit Maheshwari 2
Hello Sourav,

This can not be done by process builder. You need to go with the apex trigger and class in which you need to make query on quote object like "
select Id, Name, CreatedDate from Quote where compulsory_present__c= true  order by CreatedDate desc LIMIT 1". Then you will get the latest record and then check in that record which Barcode you have taken. and then make another query by which you will search the next barcode by name of the barcode object. and then assign that record to the quote.

Hope it will help you.

Please let me know if any help needed on the same.

Ankit Maheshwari