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



Please find me the solution for this problem. 

I have a object assigned_consultent__c. It contain fields name, projectname__c, startdate__c, Enddate__c.

For eg: name = xyz

project__c = abc

Startdate__c = 2/8/2011

Enddate__c = 20/8/2011


I have taken the days from the Enddate and StartDate.

And I have  a another object name Sheduling__c. It contain field name, project__c, day1__c, day2__c, ........ day31__c . 

Now I want to save the data from the assigned_consultent__c to Sheduling__c. According to the date. 


For eg: here date start from 2 and enddate is 20. 

According to date I want to save the date as

day1__c = false;

day2__c = true;

day3__c = true;

day4__c = true;


day31__c = false;


It mean that day which is between the startdate__c and the enddate__c should be true and others should e false.


Please help me 




Well you could take the value of the start and end date fields, convert to string and parse to get the day value (i.e. 2 and 20 in your example). And then have a really complicated if else if construct to set the value for each of the days on teh scheduling object.


But to be honest, I'm not sure having all those fields is the way to go. I would have thought use of a start and end date (similar to assigned consultant) would be better. Or failing that a master detail relationship between schedule and a day object.


Depends on what you're trying to do of course...


I don't know is this the right way to do it. Is it possible to loop the fields in the object.