Hi,
I am doing this initially for business WS but ultimately I need this for all create forms in Smart UI. This post is kind of part Smart UI JS, and part Oscript, and this may be difficult to follow.
What I'm trying to get: Any request to create an object, I want to add my own custom ID to the REST POST/PUT that sends data to create the object. This should be a hidden field, not viewable by anyone, but only accessible to any UI elements that I write.
Why I need this: I have an alpaca form extension where I implement some additional UI to get additional information to associate with my category attribute. For the case of Update, I already can save this information easily since the node already exists, and to save my data, I don't need to interact with the form. For the case of a new object, the object doesn't exists yet, so the additional UI needs to write that data to a cache. I want to associate the cache with the create request, which is why I need to get that ID (in this case, a cache ID) into the create request.
What I have so far:
I managed to override the CSNode object, so it includes my custom prototype, called external_emlc_cacheid which I set to a default value of 65530 (just to help me find it when I'm exploring the DOM - I will change it to zero later, and the UI should be able to update this with whatever I get back from LLIAPI.CacheUtils.Add() )
When I go to create a business WS for instance, the form call looks like this:
Even better, if I go to create the business WS, that external cache ID I added to the prototype for the default CSNode Create action is included in the POST REST create call.
So now my big question is how the **** do I access it?
In my alpaca form extension, I have access to the connection object. Here is the source:
In the connector object, I'm able to get to a node object, which in theory should have my external cache ID. When I output to the console, I get this:
As you can see, the external ID I added is missing. I need to access it from my al paca form extension so I can change it when my UI updates additional information in Content Server and sends back where it stored it.
I suspect what this boils down to are these questions:
1) What additional JS or server side plumbing do I need so that the node object I can access from the al paca form field is accessible either to read or to write?
2) How do I go about updating it?
3) If connector.context._factories.node is not the best place to access this data, where is?
4) Is there a better way to do this than overriding the CSNode::NodeActions::Create object to add my own prototype?
Thanks in advance
-Hugh