Can't Save new Entity?

My function gets stuck after creating a new Entity, When trying to save it. I don’t have any sources in the “Catalog” area. Maybe that’s the issue? Thanks for any ideas:
FUNCTION CODE HERE:
var newAccount:cs.ACCOUNTEntity
var saveReslt:object

var newcel1:string = replaceString(contactCel,".","")
var newcel2:string = replaceString(newcel1,"-","")

var newcel:String = String(num(newcel5))
var newzip:number = num(newzip4)
var newpodSSN:string= String(num(newPodSSN4))

if(not(errorsBool))
	
	newAccount = ds.ACCOUNT.new()
	newAccount.nickname = acctName
	newAccount.primary_contact_name = contactName
	newAccount.primary_contact_cel = newcel
	newAccount.primary_contact_alttel = contactAltTel
	newAccount.primary_contact_email= contactEmail
	newAccount.docs_addressee = statementsAddressee
	newAccount.docs_email = statementsEmail
	newAccount.docs_street = statementsStreet
	newAccount.docs_city = statementsCity
	newAccount.docs_ST = statementsST
	newAccount.docs_zip = newzip
	newAccount.jtwros = jtwrosBool
	newAccount.pod = podBool

//HERE IS WHERE I GET AN ERROR
//IT SAYS CANNOT SAVE THE ACCOUNT ENTITY
saveReslt = newAccount.save()
result = {nextpage:“register_account_holders”,saveres:saveReslt.statusText}
else
result ={nextpage:“register_account”,saveres:“88”}
end

Any ideas welcome…

Hi @musseman ,

Have you tried to review the content of saveReslt in the debugger?
This object can contain several errors leading you to the problem’s cause: Entity.save() documentation

I have looked at the documentation on entity.save() but it seems like the function returns before that data is captured or some other error preventing me form seeing that data. I have not tried the debugger yet. Will review documentation for it and give a try. Thanks.

I ran the debugger. 1 Error was flagged at:
saveReslt = newAccount.save() The new Entity of the ACCOUNT Dataclass cannot be saved.
This was the 1 of 1 problem. Hmm?

hum, strange indeed.

In the debugger,

exploring the saveReslt.errors collection of objects should give you several errors (the error stack). only 1 error in there?

If yes, you can open a case on support.qodly.com in order for us to check what’s going on.

There is a few things you might also want to check:

  1. Check your model to review there if you set rules for a field or another, such as required or unique field. Although this kind of problem should appear in the error stack.

  2. Did you already set permissions in Roles & Privileges? (Although permission errors are returned as such.)

  3. You can try to restart your Qodly Server to see if it solves the issue.

  4. You can try to add a new entity in this table by using the Data explorer and see if the same error is returned.

  5. Diagnostic logs may also be of help to understand the reason of this issue.

1 Like

This was a really helpful answer! These are great steps that i should have thought of some of them. The issue is solved. The key was to go into Data Exploerer and manually try to add and save. Apparently when I setup this table I played with a few of the attributes in the property area and left one attribute selected as mandatory. The data explorer gave an error when I tried to add/save new record, and pointed me right to the problem. Thanks so much!

1 Like