Question

Duplicate Validation while inserting data via DATA Service

Hi Team,

 

We have a scenario where we are inserting data via data service in contact table (Example ) . We want to validate using contact email address and phone number while inserting the data and do not allow to insert the data if its already existed . 

 

Is there a way to achieve this ? 

 

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

                    }

                }

            }

        }

    }

};

 

Regards,

SEthuraghav N

Like 0

Like

3 comments

Hello,



Please check this link for your reference: https://github.com/bookshelf/bookshelf/issues/1313

Hope it will help you!



Best Regards,

Tetiana Bakai

Tetiana Bakai,

This logic does not applicable because the data is going to be inserted through Json structure . Not sure if we can write a logic on this . Any other example 

Sethu Raghav,

 

Hello,

 

On your service side you can add additional logic to perform the SELECT query first and retrieve data from the object to see if the data that will be inserted should be inserted (if\else check). The result of the SELECT query can be either stored in the collection or array and the webservice can access it before performing an INSERT query. If you need examples of writing the SELECT query, please use this.

Show all comments