You need to sign in to do that
Don't have an account?
Preeti Khanna 10
Update count on custom object based on records created in another object
Hi All,
Need your help as I am new to salesforce.
I have a ObjectA in which I have a field user ,start date,end date and count field .I need to update the count field based on below criteria from asset object.
(To display no. of assets from asset object -criteria is created by user from asset object(based on owner field) should match with user of object A and installationdate of asset object should be between startdate,eend date of target object and asset status should be installed.
User will enter in target object -user name,start date,end date and based on that count field should get updated from assets object.If any assets is deleted then it should be updated accordingly.
Thanks in advance!
Regards
Preeti
Need your help as I am new to salesforce.
I have a ObjectA in which I have a field user ,start date,end date and count field .I need to update the count field based on below criteria from asset object.
(To display no. of assets from asset object -criteria is created by user from asset object(based on owner field) should match with user of object A and installationdate of asset object should be between startdate,eend date of target object and asset status should be installed.
User will enter in target object -user name,start date,end date and based on that count field should get updated from assets object.If any assets is deleted then it should be updated accordingly.
Thanks in advance!
Regards
Preeti
You can achieve this functionality in two different ways
Step 1
- Create a master-detail relationship between the two objects.
- Create a roll-up summary field on parent object with count function.
Step 2:- Create a lookup relationship between the two objects.
- Create a custom field on the parent object.
- Write the trigger on Child object.
For example, I want to create a custom field (no_of_contacts) on Account object. Write a trigger on contact object.Regards,
Jyothsna
Thanks for your help!
I cannot create master details relationship as we already have 2 on object.
I have one query..Please suggest whether we need to write code on asset object or custom object becuase in my case there in no lookup relationship between the two.
I need to update count field on custom object when user is selected and start date and end date is entered by user.Then system will go to asset object and will match user name and filter date field on asset object with startdate date and end date field of custom object.Count field will be updated when user selects startdate and end date in object/when asset is updated in specified date period by a specified user..
Because asset status changed to installed suppose on 5th May but in custom object there was no record to calculate no. of records.
Now if in custom object on 31st May user make a record with start date as 1 st may and end date as 31st may to find no. of assets which are installed between 1st may and 31st may so that in count field count will be updated for assets where status is installed between 1st may and 31st may.
Thanks in advance!