05-01-2013 10:18 AM
Is it possible to use the entity events that are exposed in App Architect for the same events that occur in SlxMobile/SDATA?
I have created, in Account.OnAfterInsert, an additional Post Flush step that runs correctly in the web app.
When I deployed to my SDATA portal, it does not appear that the Post Flush step was executed. The account saved, but Post Flush never ran. I deployed the BIN folder contents and 2 modified XML files.
I am trying to find a manageable workaround for tapping into the Save event in SlxMobile. I have had a lot of trouble with this, and rather than having to rewrite the same code that is in the Post Flush step I was hoping the method would still execute.
Can anyone offer advice? Aside from not wanting to rewrite the code already in my external assembly, I really don't want to waste time banging my head trying to figure out how to get my app code to run in SlxMobile AFTER the Account and Contact are created.
Solved! Go to Solution.
05-01-2013 10:59 AM
Did you re-deploy the SDATA portal and verify that the updated files made their way into the bin folder?
My experience is that the events do fire and execute. I have built validation rules into some of these events, and they fire as well from the Mobile client (through the SDATA portal).
05-01-2013 11:20 AM - edited 05-01-2013 11:29 AM
Yep, hand copied them myself from the SDATA deployment folder (the entire BIN folder). 10 total files, and 3 non-SLX generated assemblies that are dependencies for the external assembly.
The event OnAfterInsert calls a method I wrote in this external assembly. Nothing is written to the Event Viewer as far as exceptions go, but I can tell the code didnt run because I've tested it in the web deployment and it works correctly. The records for both Account and Contact are written but my method that adds additional data to Account after its saved doesnt appear to have executed.
05-01-2013 11:27 AM
You need to make sure that your external assembly is also included inthe SData/SupportFiles/bin folder so it gets deployed to the SData site. Every time you change the code, you will need to copy it to both SData and SLXClient web portals.
Also note that Sage.SalesLogix.API.dll (the one with the MySLX stuff in it) was not put in the SData protal either, so you'll likely want to copy that one their as well.
05-01-2013 11:30 AM
05-01-2013 11:32 AM
I would copy the Sage.SalesLogix.API.dll to the sdata/bin folder and use MySlx to get the current user instead. That does work via SData.
05-01-2013 01:05 PM - edited 05-01-2013 01:06 PM
This didn't work.
It appears that the OnAfterInsert event isn't firing at all. I edited the module to use MySlx but it doesn't appear to even get into the OnAfterInsert method. All the mobile app does after saving is redirect to the Account Details view.
In my external assembly I stripped out everything and added this:
public static void OnAfterInsert(IAccount account)
{
account.AccountName = "From the Module";
account.Save();
return;
}
What I expected was this new account name would overwrite what I input into mobile. That never happened.
I have other events in the assembly that also are not firing - OnBeforeInsert and OnBeforeUpdate. Each contains some simple code that validates zip code syntax for a given country selection. I intentionally put bad zips in there and the app acted like nothing happened.
My SDATA feed URL appears to be correct as it is writing to the database I want to work with. But nothing appears to be happening outside of the save.
05-01-2013 01:13 PM - edited 05-01-2013 01:14 PM
That code should fire. A couple of things:
05-01-2013 01:19 PM
I'll try this. There is a Primary step, and it's OnAfterInsert but it's pointing to Sage.SalesLogix.BusinessRules. Shouldn't this be my external assembly?
Actually I dont want to save back to the Account; I just threw something, anything in there to see if it would go.
05-01-2013 01:25 PM
A few versions ago, dev put in some default CRUD handlers to overcome the problem with pre and post events not firing. Just make sure the primary step is there and active and you should be good.