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
prati@salesforceprati@salesforce 

Populating a field on an object based on some condition on another object

Hi,
 I have a situation here. I have an object A with differnt fields like user(lookup to  user), location__c(lookup to another object B) and date__c. It also has a field called , lets say value__c field which has to be automatically populated. all the other fields wil be loaded.
  I have another object Audit which is a series of some questions which needs to completed by  user and its value is stored in a field called 'submitted_by__c'., date__c  and a field called location__c(which is a lookup to the object B as above). Now what i want to is whenver any user creates a record in audit object by populating  submitted_by__c and location__c fields , it automatically should add 1 (always keeps adding) to the value__c of object A records but only to those records which are matched up by the fields user__c, date__c and location__c on the object A.
      I was thinking of a trigger. But I am not sure. Please given me any ideas.

Thank you
Integration solunusIntegration solunus
Hello @:prati,


                Since this is my first post, the least i would expect is your feedback,


                      About the above senario,

                                                                 it is possible if u create the roll-up summary field in the master object with count from the child record,adding filter criteria as required.Thus master-detail relation should exsit between object A and Audit



hope that answers @:Prati
prati@salesforceprati@salesforce
Hi Thank you for your reply...
But I think master detail wont work here because in the object A, the user field might have differnt values, it is not fixed and i will need to compare with differnt Submitted_by__c in the Audit object.
   Also the business would not want a master detail relation, they are not related.

Thank you
Integration solunusIntegration solunus
if there isn't any relation between two objects, its better to accomplish it using trigger rather than workflow's and any other process. Thank you,hope this helps