Skip to main content

Development

SharePoint -Assign value to hidden Meta Desc Field – Workflow

Recently our team encountered a strange issue on SPO environment, that the Meta Description (internal name: SeoMetaDescription) field was not shown on new/edit form. Although there’s a separate page to edit SEO properties, but it only applies for pages (see below screenshot):

After some investigation, I found the ShowInNewForm and ShowInEditForm properties for this field were all set to false

But for this field, the properties seems unchangeable for some reason (I can successfully change them for custom fields but not for this SeoMetaDescription field, does anyone know why?)

Okay, this “easy” fix didn’t work, and the workflow is one of the workarounds that I can think of and passed the POC. (I’ll post other workarounds in another blog)

The basic idea is to create a new field as the mask of the SeoMetaDescription field and use the workflow to update the SeoMetaDescription field value based on the mask’s value.

I’ll use SharePoint Designer to demo the process because the workflow itself is quite simple so we don’t want to waste time with Visual Studio stuff and publishing it with code.

1.Open your browser and go to the list settings page, create a custom field on the list called “SeoMetaDescriptionMask” or whatever you want.

2. Launch SPD and open the site, then go to the list you want to make the change.

3.On the Workflows section, click New button to create a workflow

4.Add an action called “Set Field in Current Item”.

And edit the action to something like this, you can also add some log to the workflow history if you want.

5.Save and publish the workflow to the list.

6.Go to list settings, click on “Workflow Settings”, edit the workflow you just created and check the two options below, this means to run the workflow right after an item get created or updated. And that’s it!

The only issue is that there’s a little delay before the real SeoMetaDescription field gets updated because it will take like seconds for the workflow to run. So if you just created one item, you will see from the view that the SeoMetaDescription field is empty, but if you refresh the page, you will find the change’s already done.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sherlock Ma

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram