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
HamptonHampton 

Batch Process/Custom Button to Field Update

Hello:

 

I currently have the following business situation.

 

We are running a door to door sales app that has been custom built on the Force.com platform.

 

I have a custom object (Site__c) with a trigger that when a Site__c record gets created, so does a record in custom object New_Door_Assignment__c. These two records have the same Name.

 

I have a second trigger that when New_Door_Assignment__c is created, multiple child records of custom object Assigned_Address__c get created.

 

New_Door_Assignment__c has five custom fields: Sales_Rep_One__c, Sales_Rep_Two__c, Sales_Rep_Three__c, Sales_Rep_Four__c and Sales_Rep_Five__c along with a custom formula field Doors_Per_Rep__c.

 

For example:

 

New_Door_Assignment__c.Sales_Rep_One__c = John Doe

New_Door_Assignment__c.Sales_Rep_Two__c = Jane Doe

New_Door_Assignment__c.Doors_Per_Rep__c = 50

 

What I want to do is to take the 100 child records (Assigned_Address__c), sort by custom field Street_Address__c, and update the custom field Rep__c on the first 50 with New_Door_Assignment__c.Sales_Rep_One__c, the second 50 with New_Door_Assignment__c.Sales_Rep_Two__c

 

From a business perspective, I would like to do this through a custom button because when a New_Door_Assignment__c record is created, we do not know who will be Sales_Rep_One__c, Sales_Rep_Two__c, etc

 

Is this something that is doable and any guidance I can get to start would be appreciated.

 

Thanks!

 

Hampton

 

sushant sussushant sus
according to my understanding u want to update first 50 with one sales people name and other 50 with other sales people name .

u can do this by query first 50 record with limit then again query 50 with concept of offset
refer this http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_offset.htm
HamptonHampton

Thank you very much I will take a look at the link you provided for guidance. Much appreciated.

 

Thanks,

 

Hampton

sushant sussushant sus
thank u