You need to sign in to do that
Don't have an account?
sai dhana
Updating priority when we change the one of the other priority...
HI,
can anyone plz help me out of this urgent requirement..
My requirement is updating the other records priority on priority field when we change any one of priority in the record in inline VF page using triggers(before/after update).
i have a custom custom object called Deal__C on that Global_priority__c is picklist fied contains 1-15 integer values. while creating the record user can select priority for the particular record or can update the priority in inline vf page also. when user updates the priority like user is updating his record priority "5" to "10" then 5 becomes 10 and 10 will become 9,9 becomes 8,8 becomes 7,7 becomes 6, 6 becomes 5. means between 5-10 values should be updated like this.(when we cahangin 5-10 , 5 to 10,then from 10 onwards should decrese -1 upto 6 ) we can have deplicate values also. and also if we change 9 th priorty to 4, 9 becomes 4, 4 becomes 5,5 becomes 6,6 becomes 7,7 becomes 8,8 becomes 9 means need to update values between 9-4. here we need to add +1 from 4 upto 8.
here is my sample code. its updating only one value but not other values.
if(trigger.isBefore && trigger.isUpdate){
for(Deal__c dl : trigger.new){
for(integer i = 0 ; i < DList.size();i++){
if(dl.Global_Priority__c!=null && dl.Global_Priority__c < DList[i].Global_Priority__c){
System.debug('=====fistif======>'+dl.Global_Priority__c);
DList[i].Global_Priority__c = string.valueof(integer.valueof(dl.Global_Priority__c));
DList[i].Global_Priority__c = string.valueof(integer.valueof(dl.Global_Priority__c + 1));
}
}
}
}
Plz share the sample code for my requrement. this is very urget requrement.
Thanks In Advance
sai.
can anyone plz help me out of this urgent requirement..
My requirement is updating the other records priority on priority field when we change any one of priority in the record in inline VF page using triggers(before/after update).
i have a custom custom object called Deal__C on that Global_priority__c is picklist fied contains 1-15 integer values. while creating the record user can select priority for the particular record or can update the priority in inline vf page also. when user updates the priority like user is updating his record priority "5" to "10" then 5 becomes 10 and 10 will become 9,9 becomes 8,8 becomes 7,7 becomes 6, 6 becomes 5. means between 5-10 values should be updated like this.(when we cahangin 5-10 , 5 to 10,then from 10 onwards should decrese -1 upto 6 ) we can have deplicate values also. and also if we change 9 th priorty to 4, 9 becomes 4, 4 becomes 5,5 becomes 6,6 becomes 7,7 becomes 8,8 becomes 9 means need to update values between 9-4. here we need to add +1 from 4 upto 8.
here is my sample code. its updating only one value but not other values.
if(trigger.isBefore && trigger.isUpdate){
for(Deal__c dl : trigger.new){
for(integer i = 0 ; i < DList.size();i++){
if(dl.Global_Priority__c!=null && dl.Global_Priority__c < DList[i].Global_Priority__c){
System.debug('=====fistif======>'+dl.Global_Priority__c);
DList[i].Global_Priority__c = string.valueof(integer.valueof(dl.Global_Priority__c));
DList[i].Global_Priority__c = string.valueof(integer.valueof(dl.Global_Priority__c + 1));
}
}
}
}
Plz share the sample code for my requrement. this is very urget requrement.
Thanks In Advance
sai.
I hope that helps.
Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_list.htm
Respectfully yours, Kevin