Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Override Form values on save of contentItem View modes: 
User avatar
Member
Member
sh_dev - 12/3/2013 4:36:37 PM
   
Override Form values on save of contentItem
I have a business requirement to alter the generated NodeAliasPath in the following way:
A: Increase the NodeAliasPath to use an 80 character home made version based on the title (ie Ignore the nodeAlias column)

I have managed to get to the point that once the user clicks 'update' the nodeAliasPath reflects the correct way. However on intiial item create/insert the default value is being created.

Something/Somewhere in the save method the value I am sending to the nodeAliasPath is getting overwritten by the system.

I have tried
DocumentEvents.Insert.After += Document_Insert_After;
DocumentEvents.Update.After += Document_Update_After;
DocumentEvents.Insert.Before += Insert_Before;

private void Document_Update_After(object sender, DocumentEventArgs e)
{
TreeNode node = e.Node;
CreateCustomAliaspath(node);
node.update();
}

On inital save/item creation, I can see the documentAlias go from the correct one the system generated one.

So.. nutshell. When I create a new contentItem the saved value is using a system generated value. When I resave or edit the document the home made value is present.
Where do I ensure that on save my custom value is inserted into the database vs the system one.
Mac

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/4/2013 2:41:04 AM
   
RE:Override Form values on save of contentItem
Hi Mac,

Thank you for your message.

So basically whenever you create a new document you want to change its NodeAliasPath to your custom one which you set in the code?

Also are you really using Kentico CMS version 5? The code you posted are for 6 and higher Kentico versions.

Kind regards,
Richard Sustek

User avatar
Member
Member
sh_dev - 12/4/2013 8:28:07 AM
   
RE:Override Form values on save of contentItem
Hi. Using version 7. I didn't notice that I was posting into version 5. Correct. Best way to modify node alias path after insert. I think however I have figured it out to use the document events move action.after instead of the after insert as it seemed to be still getting overwritten with default.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/5/2013 2:04:30 AM
   
RE:Override Form values on save of contentItem
Hi,

Thank you for letting us know.

Also Im not quite sure which event you mean, do you mind posting it for me and others?

Thank you.

Kind regards,
Richard Sustek