Error :Error 403: ForbiddenCRRRS8658E The server cannot validate the User attribute with the value. When trying to update attributes through a script
I am trying to update values of particular attributes using a script. Each time I run my script I get an error, " response: Object, status: 403, responseText: "Error 403: Forbidden Error 403: Forbidden CRRRS8658E The server cannot validate the User attribute with the value.
Requirements Management/5.0</i></p></body></html>", xhr: XMLHttpRequest, log: false, ioArgs: Object, correlationData: undefined }
This is my code:
var attributeValues = [];
result.data.forEach(function (aa /* Artifact Attributes */){
for( var prop in aa.values){
aa.values['Verified Waiver Count'] = waiverCount;
toSave.push(aa)
});
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
console.log("could not be saved");
}
});
I can see that the waiverCount gets calculated through the web console. Each time I run it I get "could not be saved". I'm not sure if it's my code, or server, or permissions that causes the errors.
Requirements Management/5.0</i></p></body></html>", xhr: XMLHttpRequest, log: false, ioArgs: Object, correlationData: undefined }
This is my code:
var attributeValues = [];
result.data.forEach(function (aa /* Artifact Attributes */){
for( var prop in aa.values){
aa.values['Verified Waiver Count'] = waiverCount;
toSave.push(aa)
});
RM.Data.setAttributes(toSave, function(result){
if(result.code !== RM.OperationResult.OPERATION_OK)
{
console.log("could not be saved");
}
});
I can see that the waiverCount gets calculated through the web console. Each time I run it I get "could not be saved". I'm not sure if it's my code, or server, or permissions that causes the errors.
Accepted answer
Hy Pooja,
If you read about the 403 state you'll see it means forbidden.
This has mostly to do with the POST statement.
So it could have to do something with the rights you'll execute the script.
Do you use OAuth?
Or, where do you define "waiverCount"?
It could be, because your in {}-brackets, it'd loose it's context (check if "this", are the same inside and outside the brackets)
does "toSave" loose it's context? (This seems to be the problem here)
particularly you just send an empty toSave to the "setAttributes" function
Unequal is written != and not !== (But it doesn't make a difference I guess)
Does "RM.OperationResult.OPERATION_OK" have a value due to it's context?
Because if it's undefined, it'll always compare to undefined
If you read about the 403 state you'll see it means forbidden.
This has mostly to do with the POST statement.
So it could have to do something with the rights you'll execute the script.
Do you use OAuth?
Or, where do you define "waiverCount"?
It could be, because your in {}-brackets, it'd loose it's context (check if "this", are the same inside and outside the brackets)
does "toSave" loose it's context? (This seems to be the problem here)
particularly you just send an empty toSave to the "setAttributes" function
Unequal is written != and not !== (But it doesn't make a difference I guess)
Does "RM.OperationResult.OPERATION_OK" have a value due to it's context?
Because if it's undefined, it'll always compare to undefined
Comments
Jonus,
Thanks for responding. I defined waiverCount at the start of my script outside of any brackets.
You were absolutely right, my problem was toSave. I changed my code to this and it worked.
var item = new RM.ArtifactAttributes(ref);
item.values['VerifiedCount'] = waiverCount.toString();
RM.Data.setAttributes(item, function(result){
if(result.code != RM.OperationResult.OPERATION_OK) {
console.log("could not be saved", result);
}
});
Instead of going through an array I directly passed in the Artifact Attribute ref.
Thanks again,
Pooja