What is the context after a CREATE object? (SOLVED)

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

What is the context after a CREATE object? (SOLVED)

Post by ddumas »

I have a Process that does a CREATE BusinessObject, in this case:

CREATE DummyIncoming..... This works.
I then do a FIND SendMemberMessages WHERE SendMemberMessages.ID=ThisDummyIncoming.MessageID
In the tomcat log I see this below:

Unable to find ThisDummyIncoming.MessageID in query FIND SendMemberMessages WHERE SendMemberMessages.ID=ThisDummyIncoming.MessageID

I am thinking that ThisDummyIncoming is the wrong context.

I know that DummyIncoming records are getting created properly because I can search them in "Search Objects"

Dave
Last edited by ddumas on Tue Dec 10, 2019 2:00 pm, edited 1 time in total.
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: What is the context after a CREATE object?

Post by idpSteve »

Hi ddumas

this = input object
that=found object

You can just try "FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"

That's what I'd do anyway.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: What is the context after a CREATE object?

Post by Jaymer »

If you just did a create, or enter new, the record is in context immediately after that statement.
The “ this “ is totally wrong here. No need.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: What is the context after a CREATE object?

Post by ddumas »

I just attached a screenshot...
Attachments
FindMessage.PNG
FindMessage.PNG (59.42 KiB) Viewed 8553 times
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: What is the context after a CREATE object?

Post by idpSteve »

That looks fine. You do know that you are finding a record, and doing nothing with it? FIND doesn't show you any results, it just puts the object(s) in context.
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: What is the context after a CREATE object?

Post by PointsWell »

Unclear what your business model looks like, but what are the attributes of DummyIncoming, I noticed that there is a MessageID attribute. How is that being populated and are you sure that it has a value? Is it an integer or a typo to Message.ID?
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: What is the context after a CREATE object?

Post by ddumas »

Yes, It was created by AwareIM as a number, and AwareIM creates numbers as bigint in MSSQL, and in this case populated with a 5. I CREATE that object just before the FIND in my screenshot. I show DummyIncoming in the app, with Search Objects, so I can see its indeed populated with a 5, so I am positive that the DummyIncoming record is there with that value. Also SendMemberMessages has a record with a 5 in it's ID. So there is a perfect match in the database.

The only "wrinkle" is that these business rules CREATE and FIND exist in an IncomingEmail Notification. But a Notification allows business rules in it, so it should work. I am now going to try moving the IncomingEmail Notification business rulesto a PROCESS, pass IncomingEmail as an input to that process, and see it that works. I should not have to do that, but will try and let you know.

Dave
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: What is the context after a CREATE object?

Post by ddumas »

I moved the Business rules to a PROCESS called by IncomingEmail, and same error result in tomcat log:

"Unable to find DummyIncoming.MessageID in query FIND SendMemberMessages WHERE SendMemberMessages.ID=DummyIncoming.MessageID"

I do see that whenever I save the Business Rule in the IncomingEmail notification, I get this attached popup dialog. I get this with the FIND as a Business Rule embedded in the IncomingEmail notification, or the FIND as a Business Rule embedded in the ProcessIncommingEmail PROCESS .

So, the context is indeed getting lost. Frustrating.

Dave
Attachments
ConfirmChanges.PNG
ConfirmChanges.PNG (75.64 KiB) Viewed 8536 times
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: What is the context after a CREATE object? (SOLVED)

Post by ddumas »

So, this was interesting.

I watched the video on context. Mandatory Video.

I learned:

Business Rules do NOT execute in any particular order, so forget about CREATEing a record in a business rule and then expecting the next Business Rule to use the context of an object in a previous rule.

Business Rules are "triggered" on a BO as the BO is created, modified. Use Business Rules to validate, and populate data. Do not use Business rules to "Do" something
Use a Process to "do" something.

Here is what I did that worked:

In the IncomingEmail notification Business Rules, I CREATE the DummyIncoming BO. That's it, no other rules.
Then in the DummyIncoming BO, I created a business rule to RUN PROCESS ProcessIncomingEmail USING DummyIncoming
Then in the ProcessIncomingEmail Process, since I have DummyIncoming as an input, I have it's context
I then FIND SendMemberMessages WHERE SendMemberMessages.ID = DummyIncoming.MessageID
Since a process runs it's business rules in sequence, I can then do anything I want, FIND, CREATE, etc and the Context will not be lost for anything.

In summary, Process is KING! :)

Dave
Post Reply