You need to sign in to do that
Don't have an account?

Problem in update lookup field
2 standard Object: Account and User
1. there's a customer field in Account : Public_Owner__c, it's a lookup field(User)
2. there's a customer field in Account : isPublic(bool)
3. there's a rule in field Public_Owner : ((Public_Owner_r.LastName != null) && (isPublic=true) )
error message is : "it's not allowed to check isPublic when Public_Owner is not null"
means: if Public_Owner == null then isPublic = true else isPublic = false;
my program(C#):
......
accounts[0].Id = id;
accounts[0].Public_Owner__c = userId
accounts[0].isPublic = (userId == null) ? true : false;
LimitInfo[] li;
here's the problem:
when I call update() to update the account, if field isPublic is false,update() is OK,else there's always a error: FIELD_CUSTOM_VALIDATION_EXCEPTION and the rule error:"it's not allowed to check isPublic when Public_Owner is not null"
sorry for my poor english,could anybody help me?
Thanx!
1. there's a customer field in Account : Public_Owner__c, it's a lookup field(User)
2. there's a customer field in Account : isPublic(bool)
3. there's a rule in field Public_Owner : ((Public_Owner_r.LastName != null) && (isPublic=true) )
error message is : "it's not allowed to check isPublic when Public_Owner is not null"
means: if Public_Owner == null then isPublic = true else isPublic = false;
my program(C#):
......
accounts[0].Id = id;
accounts[0].Public_Owner__c = userId
accounts[0].isPublic = (userId == null) ? true : false;
LimitInfo[] li;
SaveResult[] sr;
DebuggingInfo di = client.update(header, null, null, null, null, null, null, null, null, null, null, accounts, out li, out sr);
if (sr[0].success == false)
{
foreach (Error error in sr[0].errors)
{
returnValue += "errormessage:" + error.statusCode + error.message + "\t";
}
}
DebuggingInfo di = client.update(header, null, null, null, null, null, null, null, null, null, null, accounts, out li, out sr);
if (sr[0].success == false)
{
foreach (Error error in sr[0].errors)
{
returnValue += "errormessage:" + error.statusCode + error.message + "\t";
}
}
here's the problem:
when I call update() to update the account, if field isPublic is false,update() is OK,else there's always a error: FIELD_CUSTOM_VALIDATION_EXCEPTION and the rule error:"it's not allowed to check isPublic when Public_Owner is not null"
sorry for my poor english,could anybody help me?
Thanx!
Can you change the validation rule in Account to below and see if it resolves your issue
AND(
ISBLANK(Public_Owner__c),
isPublic
)
All Answers
Can you change the validation rule in Account to below and see if it resolves your issue
AND(
ISBLANK(Public_Owner__c),
isPublic
)