You need to sign in to do that
Don't have an account?
顺娟 许
How to change the code in order that some users in specific profiles do not restricted by the code?
Here's the code:
if (UtilQuote.isUpdate) {
//验证产品是否有效
for (Quote qu : Quotes)
{
if (trigger.newMap.get(qu.Id).Cnt_of_Quote_line__c >= trigger.oldMap.get(qu.Id).Cnt_of_Quote_line__c )
{
List<QuoteLineItem> inActiveProLst = [Select Id,PricebookEntry.Product2.Id,PricebookEntry.Product2.Name From QuoteLineItem where QuoteId IN:quotes and PricebookEntry.Product2.IsActive = false];
for (QuoteLineItem qli : inActiveProLst ) {
trigger.new[0].addError('该报价单有无效的产品:' + qli.PricebookEntry.Product2.Name + ',请重新选择产品!');
break;
}
}
}
how can I exclude user in these two profiles?
$User.ProfileId <>"00e90000000qoiZ"
$User.ProfileId <>"00e90000000pV2l"
it's quite easy in validation rules but I don't know how to change the code, would somebody help?
Thank you very much in Advance!!!
if (UtilQuote.isUpdate) {
//验证产品是否有效
for (Quote qu : Quotes)
{
if (trigger.newMap.get(qu.Id).Cnt_of_Quote_line__c >= trigger.oldMap.get(qu.Id).Cnt_of_Quote_line__c )
{
List<QuoteLineItem> inActiveProLst = [Select Id,PricebookEntry.Product2.Id,PricebookEntry.Product2.Name From QuoteLineItem where QuoteId IN:quotes and PricebookEntry.Product2.IsActive = false];
for (QuoteLineItem qli : inActiveProLst ) {
trigger.new[0].addError('该报价单有无效的产品:' + qli.PricebookEntry.Product2.Name + ',请重新选择产品!');
break;
}
}
}
how can I exclude user in these two profiles?
$User.ProfileId <>"00e90000000qoiZ"
$User.ProfileId <>"00e90000000pV2l"
it's quite easy in validation rules but I don't know how to change the code, would somebody help?
Thank you very much in Advance!!!
for(Profile thisProfile : [SELECT Id, Name FROM Profile WHERE Name =: 'xxxx']){
excludeProfileList.add(thisProfile.Id);
}
if(excludeProfileList.contains(UserInfo.getProfileId())){
// Don't perform any operation
}else{
// put your logic in here
}