I create a node dynamically, and it is created withe name of a member:
Document.MakeNew("Freddy Smith"...)
Thats all good, easy enough. But a business rule is that once this member has answered a feedback question she is to be de-identified (certain strings / fields to be encrypted). So I need to knwo how to change the url that appears in 'Link to document' (as this contains the member name).
Other fields are easy enough, just use getProperty("propName") and change its value to an encrypted version of the original value - can't figure out how to do likewise for the 'Link to document' / urlName.
This doesn't work Lee - all I see is a new property 'umbracoUrlName' below the original 'Link to Docuement' field. It doesn't seem to have overridden anything - definitely spelled it correctly.
Never heard of or used these override properties before, is there something special I need to do to enable them??
I'm adding the property dynamically, and using proper case. And it dooes indeed change the URL. And I then see a Link To Document Property AND an umbracoUrlName proerty in the UI (which I didn't expect, thought I'd just see the overridden value in the Link To Docuement text field).
But whatI end up with is the UI showing me the encrypted value in the umbracoUrlName field, but no change at all to the 'Link To Document Field'. Is this wrong??
Dirk, the Text rename and republish is something I'm about to to try - I did try this earlier but didn't think to do a publish, and mistakenly ruled it out as solution. Thsi will work, just manually republished a node and it did indeed haev teh desired result. Thanks!!
Lee, still keen to know more about your solution as this is applicable in a related scenario. Keen to know if I'm having an issue or just misuderstanding it?
Since you are doing this programmatically, how are you doing the Save & Publish? Are you making a call to "umbraco.library.UpdateDocumentCache(int nodeId)" also? If not - then try that ... as the NiceUrl is generated via the XML cache.
Maybe I need to do some reading up not really sure where updateCache and publish are required - that is, I see certain changes (to my custom doc typeproperties) without taking any steps in this regard.
Ok - both these solutions work - will try and tick both as correct, not sure if I can do that. Thanks again...
Change 'Link to document' programattically
I create a node dynamically, and it is created withe name of a member:
Document.MakeNew("Freddy Smith"...)
Thats all good, easy enough. But a business rule is that once this member has answered a feedback question she is to be de-identified (certain strings / fields to be encrypted). So I need to knwo how to change the url that appears in 'Link to document' (as this contains the member name).
Other fields are easy enough, just use getProperty("propName") and change its value to an encrypted version of the original value - can't figure out how to do likewise for the 'Link to document' / urlName.
Thanks in advance.
Andles...
Hi Andles,
You could add the property "umbracoUrlName" ... that will override the auto-generated URL for the content node/page.
Cheers, Lee.
This doesn't work Lee - all I see is a new property 'umbracoUrlName' below the original 'Link to Docuement' field. It doesn't seem to have overridden anything - definitely spelled it correctly.
Never heard of or used these override properties before, is there something special I need to do to enable them??
Cheers,
Andles...
And why not change the .Text property (using the Document API) and publish again, that'll change the url because you're changing the name of the node?
Hope this helps.
Regards,
/Dirk
Hi Andles,
That is strange, it should work. Hmmm... just checking, the property alias is case-sensitive - but guessing that you've already checked that?
Usually once the "umbracoUrlName" property has been added, you would need to Save & Republish the page to see the URL change.
Which version of Umbraco are you using? (not that it matters too much, as the special "umbracoUrlName" has been in there since v3)
Cheers, Lee.
I'm adding the property dynamically, and using proper case. And it dooes indeed change the URL. And I then see a Link To Document Property AND an umbracoUrlName proerty in the UI (which I didn't expect, thought I'd just see the overridden value in the Link To Docuement text field).
Then, at some later stage, I use:
memberResponseDoc.getProperty("umbracoUrlName").Value
= crypto.EncryptToString(memberResponseDoc.getProperty("umbracoUrlName").Value.ToString());
But whatI end up with is the UI showing me the encrypted value in the umbracoUrlName field, but no change at all to the 'Link To Document Field'. Is this wrong??
Dirk, the Text rename and republish is something I'm about to to try - I did try this earlier but didn't think to do a publish, and mistakenly ruled it out as solution. Thsi will work, just manually republished a node and it did indeed haev teh desired result. Thanks!!
Lee, still keen to know more about your solution as this is applicable in a related scenario. Keen to know if I'm having an issue or just misuderstanding it?
Thanks to you both for your speedy assistance!
Cheers,
Andles...
Hi Andles,
Since you are doing this programmatically, how are you doing the Save & Publish? Are you making a call to "umbraco.library.UpdateDocumentCache(int nodeId)" also? If not - then try that ... as the NiceUrl is generated via the XML cache.
Cheers, Lee.
Maybe I need to do some reading up not really sure where updateCache and publish are required - that is, I see certain changes (to my custom doc typeproperties) without taking any steps in this regard.
Ok - both these solutions work - will try and tick both as correct, not sure if I can do that. Thanks again...
is working on a reply...