How to place dynamic value in contentful? - contentful

I am using contentful. In one of the content model, I want to display dynamic value based on the option selected.
e.g. In contentful, I am having message as: Congratulations, your <USER_TYPE> account has created successfully.
I have options as admin/moderator/user then if
I select admin, message should get display as: Congratulations, your admin account has created successfully.
I select moderator, message should get displayed as: Congratulations, your moderator account has created successfully.
How can I replace <USER_TYPE> with the selected values? Please guide.

I got the answer.
In contentful, put the variable as {{ variable_name }} and in the code replace that variable_name with dynamic value as:
import Mustache from 'mustache';
Mustache.render(value, {variable_name: variable_value});
I am using vueJs, so this implementation refers javascript.

Related

Task field that links to the originating transaction

I have a custom task form that has a field which displays the transaction id (in this case a sales order)for the record the task was created in.
I would like to have this field be a hyperlink to that specific transaction but am lost on how to do this.
Is this possible?
In view mode on the task any records linked under the 'related records' tab are links to the respective record. This is automatic.
If you want on the main section you can add one with a user event script possibly coupled with a client event script.
In the Before Load user event script detect that a transaction is assigned and create a new field of type URL and use the N/url module to derive the url of the transaction.
If the user who needs the link is allowed to change the linked transaction then you could also add a client script that uses a fieldChanged event to update the value of the custom field added in the User Event script.
If you need the client script and want to eliminated duplicate code then you could set the value of the url custom field in the pageInit event of the client script (i.e. both the pageInit and fieldChanged events could use the same url resolution code.
The field must be of type List/Record pointing to a Transaction list, or an HTML type set using an <a href="url"> attribute.
I would advise against hard-coding links in the system though, and try to use the List/Record field type first.
Hope that helps! If not, feel free to comment back and I'll see what other help I can provide. If possible, please provide screenshots.

Drupal 8 - how to customise search result template

I have a custom content type with several fields like Price, Product Summary, Product image etc. Is there any way I can access these fields separately on search result page?
I printed the rendered array on mytheme/item-list.html.twig using kint(item.value) which shows that I can only access title, url and type separately like {{ item.value['#result'].url }}, {{ item.value['#result'].title }}. But don't see variables like product_image, product_summary etc. in rendered array.
According to Twig template suggestion the template I need to override is search-result.html.twig. So I copied /core/themes/stable/templates/content/search-result.html.twig to my theme's folder. However, the {{ snippet }} variable does not have information I want to access.
I went through the following steps to customise the result output:
Went to /admin/structure/types/manage/product/display (Structure > Content Types > Product > Manage Display). Turned on Search Index and Search result highlight input.
Navigated to Search result highlight input tab and added (enabled) two fields Product summary and Product price
Went back to search result but I still cannot see the those variables in rendered array.
Can somebody please tell me the best way to accomplish the above?
#Subrata Sarkar There is one option. Firstly,install two module search_api and search_api_page module from drupal.org
https://www.drupal.org/project/search_api
https://www.drupal.org/project/search_api_page
Add server and index in search api.
Add the fields which you want to display on page within index and after all configuration indexed all your data.
After this create and configure search page.And choose view mode option and select a view mode ex: Search result highlighting input or Search index etc.
Hope you get your desired result on search page.For more information,
https://www.youtube.com/watch?v=dNilEVQu94I

SharePoint online people search display template showing skills managed property

I'm currently working on creating a custom display template for people search result page. I copied out of the box Item_Person.html search display template and modified it to display some more fields.
In the out of the box template also there is a managed property called skills but when I using it, its not returning any values associated with the user profile skills property (SPS-Skills).
As you can see its already mapped but Skill value always comes as empty. I want to retrieve and display inside the custom template.
Please help me if you have done something similar.
Check the following steps
Add meta data to ManagedPropertyMapping
2.Then inside the fuction get the value of metadata
<!--#_ var datacreated = $getItemValue(ctx, "Created");_#-->
3.Then palce the variable where you want <h2> _#= datacreated =#_ </h2>
Thats it publish the html hope its work

With CodedUI, is there a way to determine that an element with a given ID exists on a webpage?

For example, if my page contains the following code:
<a id="foo" href="#">Click Me!</a>
Is there a way with CodedUI to verify that a link with id equal to "foo" is present on the webpage?
Inspect the link with the Coded IU cross-hairs (ie assertion building) tool. The properties shown should include the Id field. You can then generate an assertion that the link contains the text Click Me!. Make sure the generated search properties include the required value for the link property. If the Id field or the displayed text are variable (perhaps their values are data driven or found earlier in the test) then before finding the control (implicitly or explicitly) set the required values. This should work because the assertion can only be checked if the required field is found on the screen and that find uses teh Id field.
Perhaps your question is a more general "is there such a link anywhere on the web page"? If so then you can use the GetChilden() to do a recursive traverse of the web page. Check each UI Control found to see if it has the desired values.

How to set display name of a workflow in SharePoint 2010 programmatically

I'm having an issue setting the display name for a workflow on feature activation.
What I have got is a workflow that I create with a desired internal name (using SPWorkflowAssociation.CreateListContentTypeAssociation to get an SPWorkflowAssociation object). Once the name is set with that method call, I set the SPWorkflowAssociation.Name to the desired display name after that, add the workflow association to the list, and then call update on the associated list.
The result I see is that the internal name and the display name are both changed (internal name is required to link between the SharePoint list and the Client Side Object Model and we need this internal name as the display name is different for other languages).
Does anyone know how to set this properly in code? It looks like something that should be possible but I'm getting no joy from my investigations.
Thanks!
I got around this by using the description field to store a 'static' name and then later find associations via this description field rather than the internal name.

Resources