Help with inbound action: did not create or update <table> using current

MB12
Kilo Sage

Hi Experts,

 

I'm having issues with an inbound action I created for a custom CI Class (u_cmdb_ci_certificates). I understand there's already a cert class, but I'm testing this for something else.

 

To Summarize: I have an inbound action to update the state of the CI and add comments. The target record is getting populated in the email log, but I'm receiving the error "did not create or update u_cmdb_ci_certificates using current."

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

	// Implement email action here

processRetireCert();

function processRetireCert() {
current.comments = "reply from: " + email.from + "\n\n" + email.body_text;
current.u_state = 'retired';
current.update;
}
})(current, event, email, logger, classifier);

The reply email subject includes the sysid for the record in the subject line, and the watermark. The inbound action is getting triggered.

 

I'm having trouble figuring out what I'm doing wrong. Any assistance would be greatly appreciated. 

 

Note: I was able to get this to work using the field actions, so I assume there's something wrong with my script.

 

Thank you,

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

If you want to update the record, you should call the update function:

current.update();

instead of just dumping a reference to it:

current.update;

To be clear, it is about () being there or not.

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hello,

Is the state field really: u_state?

I would imagine it's an out of box state field and thus would be called "state" not "u_state".

So in your script, it could be causing errors there.

It's always best to add log statements in scripting such as: gs.info("sample log entry"); etc. so you can see what you're doing, if the function is being accessed, what values you may be getting etc. else you're just coding in the dark...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

-O-
Kilo Patron
Kilo Patron

If you want to update the record, you should call the update function:

current.update();

instead of just dumping a reference to it:

current.update;

To be clear, it is about () being there or not.

Thank you! I completely overlooked that - everything is working as intended now. 

-O-
Kilo Patron
Kilo Patron

You're welcome and I'm glad everything is working. Also, appreciate the feed-back! 🙂