Is it possible to populate properties in backoffice on creation?
I'm wondering if it would be possible to pre-populate fields in the Back-office when creating contents.
For example, let's say that i want to populate a textbox with the creators IP-address. Of course i can do it with the save/saved/publish/published-events, but if possible I'd prefer if it were already typed in when first rendered.
You could create your own property editor that is just label that autopopulates users ip address. Then put that property editor on a base doc type or use a composition.
I could!
But what if i wanted it to be applicable to any property. Like if i had a template that i wanted to string.Format with something like the users name?
Something like:
string.Format("Lorem ipsum dolor sit amet, consectetur adipiscing elit. {0}, {1}}", userName, ipAddress).
The example is somewhat crude, but I would like a event or such to be able to modify - or pre-populate data. Pretty much the same way I can handle the properties in the events mentioned above.
I'm not asking for help with a specific problem, rather looking for a general approach to it.
The 'unsupported' but seems to work route i have used a few times is to use the ContentService.Created events (which have been obsoleated) but do fire when editors create new content in the UI (but i don't know for how long) - seems to work upto latest v7.6.x release)
You could also look at Angular Interceptors which allow you to intercept the javascript as it loads up the content.
You could also look at a Delegating Handlers which is a way to do similar things to Angular Interceptors from the back office (so in c#)
Umbraco 7.7 has Umbraco Blueprints. which might be the easiest way (if you don't want dynamic values).
and you could write your own property editors - which could load values dynamically when they are loaded onto the editor page by umbraco ?
I am bad - so i've done the top one (ContentCreated) and it works, for now....
Thank you Kevin!
I'd look into these. I guess that ContentService.Created it pretty much what I'm looking for. In my specific scenario the creation of the node will always be initiated by a user in the back-office. So I assume that the event will be triggered 100% of the times.
Is it possible to populate properties in backoffice on creation?
I'm wondering if it would be possible to pre-populate fields in the Back-office when creating contents.
For example, let's say that i want to populate a textbox with the creators IP-address. Of course i can do it with the save/saved/publish/published-events, but if possible I'd prefer if it were already typed in when first rendered.
How would I do that?
Anders,
You could create your own property editor that is just label that autopopulates users ip address. Then put that property editor on a base doc type or use a composition.
Regards
Ismail
I could! But what if i wanted it to be applicable to any property. Like if i had a template that i wanted to string.Format with something like the users name?
Something like:
The example is somewhat crude, but I would like a event or such to be able to modify - or pre-populate data. Pretty much the same way I can handle the properties in the events mentioned above.
I'm not asking for help with a specific problem, rather looking for a general approach to it.
:)
v 7.7 has templates formerly known as blue prints maybe that can help https://umbraco.com/blog/hello-umbraco-77/
The 'unsupported' but seems to work route i have used a few times is to use the ContentService.Created events (which have been obsoleated) but do fire when editors create new content in the UI (but i don't know for how long) - seems to work upto latest v7.6.x release)
You could also look at Angular Interceptors which allow you to intercept the javascript as it loads up the content.
You could also look at a Delegating Handlers which is a way to do similar things to Angular Interceptors from the back office (so in c#)
Umbraco 7.7 has Umbraco Blueprints. which might be the easiest way (if you don't want dynamic values).
and you could write your own property editors - which could load values dynamically when they are loaded onto the editor page by umbraco ?
I am bad - so i've done the top one (ContentCreated) and it works, for now....
Thank you Kevin! I'd look into these. I guess that ContentService.Created it pretty much what I'm looking for. In my specific scenario the creation of the node will always be initiated by a user in the back-office. So I assume that the event will be triggered 100% of the times.
Just saw that the ContentService.Created (nor Creating) isn't deprecated in the code base. To whoever it may concern.
:)
is working on a reply...