Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Incorrect Attribute Value

$
0
0

"2147220989 - Incorrect attribute value type System.Int32"

Getting the error message above when running this section of code in a Post-Operation Plugin on the Update function. The Update function is linked to the form new_contractreview.

The code is meant to reset the value of a custom OptionSet field (new_contractstatus). The code resets it from the value 100,000,001 (Sending) to 100,000,000 (Pending).

// Get the GUID
Entity CSVentity = new Entity("new_contractreview");
Entity ent = (Entity)context.InputParameters["Target"];
CSVentity.Id = ent.Id;

// Set the value
OptionSetValue myoptionset = new OptionSetValue();
myoptionset.Value = 100000000;
CSVentity.Attributes["new_contractstatus"] = myoptionset.Value;

// Update the ContractReview Record
service.Update(CSVentity);

// Display error message
throw new Exception("Error: Order charge file failed to write. The order charge file could not be exported.")

Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>