Stumbling Through: K2 Blackpearl (Smart Objects - Part II)
We left off last time hitting a wall in our attempt to create our custom 'Create' methods for each of our asset types. For some reason, we weren't getting the columns we expected when we linked the Smart Object to our Clarity Assets list. Even after refreshing our smart object service, we still didn't see the columns we were expecting. Well, what I failed to do while we were stumbling around in there was to actually refresh my local view of the Smart Object Server after refreshing the service definition. Duh! The 'refresh' command is available off of the little dropdown menu next to 'Environment' in the Context Browser.
Anyway, lets get back to business and create our 'CreateLaptop' method:
Ahhh... That looks much better. We can bind directly to our Laptop content type's 'Create' method. NOW we can use 'Create All' to create local variable mappings of all the content type columns:
Repeat this process for Monitors and Hard Drives, so we have a total of three create methods:
Notice now that we also got a 'Content Type' property for free out of this... that will be useful when getting/setting the asset type of the request. I'm beginning to wonder if we need to create those properties manually at all, or if they would've been created when we added the Create methods. I'm gonna start from scratch again to prove that out.
Jackpot! That is exactly what that 'Create All' button does when you are mapping your fields. Live and learn:
Great, so, we have our nicely defined Smart Object, what do we do with it now? That is a post for another day...