Showing error "Invalid insert" and redirecting to some other pages after clicking svae or submit button.

Chaitanya Redd1
Tera Guru

I'm trying to create new project request after Clicking on Sav or \Submit button it's showing error.

find_real_file.png

and redirecting to other page.

1 ACCEPTED SOLUTION

Since, its before insert current.update() is not required.

View solution in original post

6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

That would mostly be because the number is not unique. I suggest you to do the following.

1. Look for System Log >> All for some decriptive message that shows up when you try to insert.

2. Look if there are any Business rule that runs before & has current.update()

Thanks Jaspal, I have created two business rules which runs after and has current. update.

I set them deactivated but I need them to work because it's linked with one of related links on the form. Can you help me to change the script.

 

var milestone = new GlideRecord("u_milestone");
 milestone.u_project = current.sys_id;
 milestone.insert();
 current.u_milestone = milestone.sys_id;
current.update();

Afer marking Business rule as in-active did you get any error message? Also, what I understand you need to have milestone inserted with current project number & then update the project with that milestone number. If so, try using below in before insert business rule on project table.

var milestone=new GlideRecord('u_milestone')
milestone.initialize();
milestone.u_project = current.sys_id;
milestone.insert();

current.u_milestone = milestone.sys_id;
current.update();

It's creating duplicate records.