Question

Getting error: Terrasoft.Common.ArgumentNullOrEmptyException:'Value for Arguments "query Expressions" must be specified' while using GetEntity method

Hi,

 

Step 1: In a backend code, I have triggered an event onUpdated for an  approval object on a custom section-'ContactUpdateRequest".

step 2: Then got Id of 'ContactUpdateRequest' from the approval object .

step 3: Created an Entity schema query for 'ContactUpdateRequest' section

step 4: Now, using GetEntity method I got the record with the Id retrieved in step 2.

While debugging the code, I am getting error as below at step 4:

Terrasoft.Common.ArgumentNullOrEmptyException:'Value for Arguments "query Expressions" must be specified' while using GetEntity method.

Below is the code I have used:

Like 1

Like

3 comments

Hi Indira, 

 

It might happen because of wrong type casts. 

 

Please еry to specify the id explicitly, like this: 

esq.GetEntity(userConnection, new Guid("e76f59d2-c8ca-4bc1-80fd-0cdf02ab92dc"));

 

Best Regards, 

 

Bogdan L.

Hi Bogdan,

 

Thanks for Reply.

We have also tried this statement . This also returned the same error. 

Is it beacause I am using user connection that came from entity event?

 

Please provide a solution. and also, Is there any way to add all columns to a Entity schema Query.

 

 

Hi Indira, 

 

Please try to use userConnection not from the entity event.

 

Here are some examples: 

 

https://community.creatio.com/questions/how-create-or-update-record-usi…

 

In order to add several columns you may use this code: 

 

EntitySchemaQuery esqResult = new EntitySchemaQuery(userConnection.EntitySchemaManager, "YourEntityHere");
 
esqResult.AddColumn("CreatedOn ");
esqResult.AddColumn("Status ");

 

Also please check this information with adding columns list using js: 

 

https://academy.creatio.com/docs/developer/front-end_development/crud_o…

 

Best Regards, 

 

Bogdan L.

 

 

Show all comments