issue of sql trigger in rollbase

Posted by shilpi.agarwal3373 on 17-Dec-2015 23:23

Hi all,

I am able to bring data from Sql Server2014 which is configured on data direct cloud in rollbase application. Also I have defined a trigger in sql server which says that same customer name record will not be added, means only unique customer name record will be added into customer table. So this trigger works fine in Sql Server when i try to insert a record with previously defined customer name, an error appears, "Customer .... already exits".

So My question is How to access this trigger in my rollbase application? Currently in rollbase application I am getting a System Error. Instead of it, I want the same message "Customer...already exists" in rollbase app also.

Please clarify this issue.

All Replies

Posted by Manooj Murali on 18-Dec-2015 01:16

Hi -

In Rollbase customer object, the customer name field is not editable. But, its value is set by the value of "Company Name" field. So, you can set unique constraint on the "Company Name" field by editing the field & selecting the checkbox that says " Do not allow duplicate values in this field." . With this, whenever the company name is provided that already exists, there would be a validation message on the UI (during form submit for customer creation) & the message would say " Company Name "XXXX" is already in use."

Otherwise, you can also try using a "validate Data Record" trigger with a "Before Create" timing option and loop through all customer records and check if the name is already in use.

The former would be an effortless task.



Posted by shilpi.agarwal3373 on 18-Dec-2015 01:33

My ques is:-  Is there any way to process the trigger which is defined in Sql server in rollbase application or I will have to create  a new trigger in rollbase for the unique customer name?

If latter one is chosen so again my issue is :-  Cann't I access the sql trigeer in rollbase app? Because when i create a new customer or update or delete from rollbase app then the changes reflect in database also. So why Cant we use the sql trigger in rollbase?

Trigger in sql server is

USE [MyCustomer]


/****** Object:  Trigger [dbo].[tgr_Customer]    Script Date: 18-12-2015 13:02:41 ******/





ALTER TRIGGER [dbo].[tgr_Customer]

ON [dbo].[Customer]




DECLARE @cust_name varchar(50)

SET  @cust_name = (SELECT Custname FROM inserted)

IF (SELECT COUNT(*) FROM Customer WHERE Custname =  @cust_name) > 1



RAISERROR('Customer %s alreay exists', 1,1,@cust_name)



Posted by Manooj Murali on 18-Dec-2015 01:45

No, we don't have provisions in Rollbase to use/access sql triggers. Any failed database operation is treated as an error in Rollbase which is what you see.

This thread is closed