Question

Insert data in Contact table using Data Service

Hi,

I'm trying to insert records in Contact Table using Data Service in C# .Net Application.

Below is my sample code:

var insertContactQuery = new InsertQuery()

{

    // Root schema name.

    RootSchemaName = "Contact",

    // New column values.

    ColumnValues = new ColumnValues()

    {

        // Key-value collection.

        Items = new Dictionary()

        {

            {

                "Account",

                new ColumnExpression()

                {

                    ExpressionType = EntitySchemaQueryExpressionType.Parameter,

                    ColumnPath = "Account",

                    Parameter = new Terrasoft.Nui.ServiceModel.DataContract.Parameter()

                    {

                        Value = AccountID,

                        DataValueType = DataValueType.Lookup

                    }

                }

            }

        }

    }

};

Here, I want to insert the value for an Account by its Name and not by Id.

Can I do so? If Yes then How? It'll be great if you can share some piece of code for it.

 

Like 0

Like

1 comments

Dear Jayminta,

Please check the following article on the Insert class:

https://academy.bpmonline.com/documents/technic-sdk/7-13/building-queries-adding-data-insert-class

I believe the second example is most likely fitting to what you are looking for.

Regards,

Anastasia

Show all comments