I have a doc type to witch I have added a checkbox (true/false) data type. What I want to do is if the user checks this and save and publishes i want to the run some custom server code.
The only way I can think of doing this would be to remove the built in checkbox and replace it with a custom built angularjs one which in turn will use an ajax call to an umbraco web api method which will in turn run some server code.
yeah seems like a good alternative for what im trying to achieve. For convention what folder would you keep these classes in?
One other last question i dont know how much experience you have with custom data types and angularjs but is the only way to run server side code from angularjsby making ajax calls to umbraco web api.
best way to run server side code on document save
Hi,
I have an umbraco 7 instance.
I have a doc type to witch I have added a checkbox (true/false) data type. What I want to do is if the user checks this and save and publishes i want to the run some custom server code.
The only way I can think of doing this would be to remove the built in checkbox and replace it with a custom built angularjs one which in turn will use an ajax call to an umbraco web api method which will in turn run some server code.
My question is is this the only/best appraoch?
Thnaks
lj
Hi lj,
You probably want to hook into the Content Service Saved event. From there, you'll be able to run some code based on what an editor is saving:
Thanks, Dan.
Hi Dan,
Would this code run every time any page was saved and not just for pages of a specific doc type?
Thanks
lj
Yeah it does but you could change you foreach statement to only loop through pages of a certain document type:
Thanks, Dan.
yeah seems like a good alternative for what im trying to achieve. For convention what folder would you keep these classes in?
One other last question i dont know how much experience you have with custom data types and angularjs but is the only way to run server side code from angularjsby making ajax calls to umbraco web api.
Thanks
lj
You can put the classes where ever you like really. An Events folder might be good place.
I've not tried what you want but I'm guessing you'll want to write an Umbraco Web API Service to be triggered from your custom data type when updated.
Thanks, Dan.
Yeah thats exactly what I thought.
thanks for the help.
lj
No worries. Glad I could help :)
Thanks, Dan.
is working on a reply...