I am trying to get and then access a dollar value that has nothing to do with a d365 record.
It’s a total dollar value that I need to use to populate a field on a record in D365.
I must assign this field to an output parameter as part of a custom workflow activity, so the value is available to use in the workflow.
I have a fetch XML query that gets this value by doing aggregate addition.
This is the output as it is a single value as shown.
There is no “record”, no “Guid”, this is just a numeric value I need to get and deal with.
The problem is my code below is trying to access it as if it is a d365 entity record, which of course it cannot.
public class ResultTypeMoney : ACECalculateTax { protected override void Execute(CodeActivityContext executionContext) { base.Execute(executionContext); if ((service.RetrieveMultiple(ActiveRecordQuery_1).Entities.Count) > 0) { Result_1.Set(executionContext, service.RetrieveMultiple(ActiveRecordQuery_1)); } else { Result_1.Set(executionContext, 0.00); } if (service.RetrieveMultiple(ActiveRecordQuery_2).Entities.Count > 0) { Result_2.Set(executionContext, service.RetrieveMultiple(ActiveRecordQuery_2));} else { Result_2.Set(executionContext, 0.00); } } [Output("Result_1")] public OutArgument Result_1 { get; set; } [Output("Result_2")] public OutArgument Result_2 { get; set; } }
Line 7-9 and 11-13 are attempting to access and deal with the result of the fetchXML query as if it were a record with Guid, Entity, and Fields.
The code below is looking to access an entity.
if ((service.RetrieveMultiple(ActiveRecordQuery_1).Entities.Count) > 0)
However, I just need to check to see if the dollar value exists and if it is created than 0.00
if (555.55/or whatever this value is because it will always be different > 0)
What do I need to change, so that I can access the value in the returned cpp_priceadjustmenttotal_sum field directly as if it were a variable and not an entity?