Trying to customize a multiple item lookup field using JSLink
I'm trying to Customize a multiple item lookup field using JSLink, in SP 2013. This illustrates what I want to do:
I can replace the ";" with <br /> in the Text column, but not the Lookup column. Here is the JSLink code I'm using for the Text column.
(function () {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {
'Text': { 'View' : '<#=ctx.CurrentItem.Text.toString().replace(";","<br />")#>' }
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
How can I display each item on separate lines in the Lookup column?
You can retrieve the values of the lookup column and reformat their display by replacing the following:
overrideCtx.Templates.Fields = {
'Text': { 'View' : '<#=ctx.CurrentItem.Text.toString().replace(";","<br />")#>' }
with something like this:
overrideCtx.Templates.Fields = {
'Lookup': { 'View' : function(ctx) {
var arr=[];
var fld=ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
for (i=0; i<fld.length; i++) {
arr.push(fld[i].lookupValue);
return arr.join("<br/>");
Here we are looping through each lookup value contained in the multi value lookup field and adding it to an array. Once complete, we use join to flatten the array and separate each entry with the <br/>. Note...this will show each value on a new line,
but it will be the string value without the hyperlink. If you want the actual hyperlink to the item, you can rebuild the hyperlink and add that to the array instead. You can get the item's display form from ctx.CurrentFieldSchema.DispFormUrl and the
item's id from fld[i].lookupId for rebuilding the hyperlink.
Similar Messages
-
Hi All,
I am working with SharePoint 2013 designer workflow. we are using office 365.
Our requirement to send email to multiple users, get the user groups from lookup list people and groups column.
But SP designer sending emails to the first user alone.
Please guide me to proceed.
Advance Thanks.
Regards
Jenkins NS
Thanks and Regards Jenkinsfinally I got a solution
Identified a workaround to solve the issue using SharePoint designer.
Step 1
Create a lookup list Example department
Columns
Title (by default) – Single line of text
Users – Person or Group
Emails – Multiple lines of text
hidden the Emails column (go to content type and set the column as hidden)
Create a SharePoint designer Workflow
Start Workflow automatically when an item is created
Also Start Workflow automatically when an item is changed
Workflow Stage 1
Set Emails to current Item: Users
The workflow will get all users email ids and add in the Emails column delimiter as semicolon.
Step 2
Create a custom list to get the email ids and send email
Create a lookup column ex: analysis and refer department list, Allow multiple values
Then Create a SharePoint designer workflow
full details workflow steps please follow below
URL
http://jenkinsblogs.com/2015/04/30/how-to-send-emails-to-multiple-users-from-lookup-list-people-picker-field-using-sharepoint-designer-workflow/
Thanks and Regards Jenkins -
Disable text box on selecting a checkbox of multiple selection lookup field in infopath 2010
Hi
In edit mode of the form,
We have added one field in infopath which is lookup column and shows multiple selection chekboxes.
One of the option from that lookup checkbox list is "Other".
There is one textbox field which will be disabled by default.
We want to enable this text box on selection of "Other" from lookup field checkbox list.
Is it possible?
if yes how can we do this?Hi Vyanky, I don't believe that's possible without some major functionality. The problem, as you probably know, is that it's a lookup with checkboxes. If it was added directly in InfoPath, then it wouldn't be an issue. You should consider adding "Other"
as a separate yes/no field instead. That way you'll be able to add an action rule to it to enable the text box.
cameron rautmann -
Why can I not select multiple items in Muse using Shift Click after installing update?
I am trying to select multiple items on a Muse page by holding shift and clicking each items. This has been pretty much my standard method across Adobe products but after updating Muse it will no longer let me do this. Am I missing something or did this method change with the update?
It seems to be happening mostly for Hotmail account. I just rebooted and tested two accounts. Only in Hotmail now.
-
Trying to retrieve content from a text field & use it in a conditional statement
Hi Everyone,
I have a form with a text field and a button. The text field is called "orderNo", and the button is called "genOrder".
Initially the text field is empty, and clicking on the button fills the text field with an appropriate order number.
I need to check the text field for data (content) before writing the order number to it, this way if an order number is already present in the text field it will not be over written.
My intention is to use an if / else structure to perform the testing, however I don't know how to retrieve the content of the text field (if content is present!).
If anybody can suggest how I can go about retrieving the content of the text field and then use it in an if / else statement it will be greatly appreciated.
Kind Regards,
DavoHi try67,
Thanks for your assistance. I have posted in this http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=70276#p70276 forum asking for further assistance if your able to help more.
Once again thanks for your time.
Cheers
Davo -
Set lookup field value based on another lookup field using Infopath 2010 rules
Hello,
I created 3 lists in SharePoint 2010: Lists A, B and C. The lists B and C where create to work as a drop-down fields in List A. My question: How to I set field C automatically based on what is selected on field B using Rules in Infopath 2010?
I don't know what to put in the third field:
Thanks,
ElvisIt looks like you edited the question since you first asked it. When I posted my first answer, there were no screenshots in your question and it was not easy to figure out what you want to achieve.
I asked for clarification. You did not reply to my post.
Instead it seems that you edited your question and added more detail. This is good, because it helps people to understand what you are asking.
But when you change a post (YOUR QUESTION) that others have already replied to, you must acknowledge these replies and let people know that you are posting new information.
In this forum, people get emails when there are new replies to a question. That's how I found back to this thread. I do not get an email if you edit your question to add more information.
So, don't be surprised if you edit your question and people still don't respond. The people why have already replied to your question will not be notified if you make changes to your original question.
If you want to make sure that everybody who is interested in your question gets notified about new information, please add the information in a new comment to the question, or edit the question and then post a new comment "I added more details".
This way, everybody already subscribed to your question will be notified about the new content and can help you find a solution.
cheers, teylyn -
Hi!
Version Info: SharePoint 2013 Server Standard (*BTW...I do not have access to Visual Studio*)
I have two lists, let's call them
-Assets
-Asset Checkouts
"Assets" is the parent list, and "Asset Checkouts" has a lookup column (multiselect) which is tied to the serial # column in the "Assets" list.
Basically, what I need to accomplish is this: I would like to be able to select multiple list items in the "Assets" list, and create a new item in "Asset Checkouts", and pre-fill the multiselect lookup column in the NewItem form
for "Asset Checkouts" with the values from the selected items in "Assets".
Any ideas or suggestions on how to do this would be most appreciated!
Thanks!Hi,
According your description, you might want to add new item in "Asset Checkouts" list when selecting items in "Assets" list.
If so, we can achieve it with SharePoint Client Object Model.
We can add a button in the "Assets" list form page, when selecting items, we can take down the values of columns of the selected items, then click this button which will create
new item in "Asset Checkouts" list with the values needed.
Here are some links will provide more information about how to achieve it:
Use
SP.ListOperation.Selection.getSelectedItems() Method to get the list items being selected
http://msdn.microsoft.com/en-us/library/ff409526(v=office.14).aspx
How to: Create, Update, and Delete List Items Using JavaScript
http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
Add ListItem with Lookup Field using Client Object Model (ECMA)
http://notuserfriendly.wordpress.com/2013/03/14/add-listitem-with-lookup-field-using-client-object-model-ecma/
Or if you just want to refer to the other columns in "Assets" list when add new item in "Asset Checkouts" list, we can insert the "Assets" list web part into the NewForm page
of the "Asset Checkouts" list, then when we add new item in the "Asset Checkouts" list, we will be able to look through the "Assets" list before we select values for the Lookup column.
To add web part into the NewForm.aspx, we need to find the button "Default New Form" from ribbon under "List" tab, then we can add web part in the NewForm.aspx.
In the ribbon, click the button “Default New Form”:
Then we can add web part into NewForm.aspx:
Best regards
Patrick Liang
TechNet Community Support -
How do i select multiple items on a page using firefox on a mac?
I am trying to to figure how to select multiple items (email addresses) using firefox on a mac. I use a web based manage my business. I am trying to send emails to multiple people.
I have tried clicking on the first email and hold the command key while selecting the others. The selection just jumps.
I tried holding the shift key and and it selects everything between the 1st and 2nd email address I want to use.
I also tried the control key which just brings up a menu.
Any help would be greatly appreciated.This may just be a limitation of the email site you are using. Is this a public site that I can test and try to reproduce the issue?
-
Update termination error while parking multiple items using BAPI fn module
hi experts,
i am facing a problem with bapi_incominginvoice_park.when i am trying to park invoice for single item for the po the invoice number is generating and getting updated in database in the same way when i am trying to park for multiple items the invoice number is genrating but not getting updated in database table.Here i am getting error 'Express document update terminated BY THE user'.How to solve this problem to find these error i have gone to se13 transaction,there it is showing SAQCL_DUPRC.it is saying duplicate errors in table but there are no duplicates in table.
Thanks,
Vinodhi vinod ....i tried the following it worked...
while sending tax info dont send any tax table manually i.e updating the vit_tax table using append statement
also while testing function module for multiple PO , no need to provide the tax info in the tax table
what we have to do is only to provide 'X' In the tax calculation option in the header details
HEADERDATA-CALC_TAX_IND = 'X'.
1.this will enable tax
2. will make the po status green so that the parked document can be posted . -
Is there a way to select multiple items in the open dialogue (ctrl+O)?
Sometimes I would like to open multiple items at once using ctrl+O, but in the dialogue, I can only select one item at a time.
This also applies to Firefox 4.No, sorry. I suppose you could try running the files via Windows Explorer.
-
Assignment on Multi-Valued Lookup field
Hi experts,
Is it possible to assign value to a multi-valued lookup field using assignment.
For example, "Products" is the main table. In the products table I have a multi-valued attribute "PLANT". Product table contains a field "PLANT" of type look-up multivalued to the Plants table.
So, is it possible to assign Plant attribute values to PLANT Look-up multivalued field in the main table using assignment??
Is not, then is there any other work around solution to acheive this requirement?
Best Regards,
Shivhi,
So, is it possible to assign Plant attribute values to PLANT Look-up multivalued field in the main table using assignment??
No this is not possible, to get the values of the plant attributes you again have to lookup at the plant master data and fetch the values from there in the routine.
regards,
Arvind. -
Lookup field in self registration form
I have added a user defined lookup field using Design View.
I added the following attribute to FormMetaData.xml:
<Attribute name="USR_UDF_LOCATION" label="global.udf.USR_UDF_LOCATION" displayComponentType="LookupField" map="USR_UDF_LOCATION" >
<ValidValues lookupCode="Lookup.Custom.Users.Location"/>
</Attribute>
The new lookup field is showing in 'Create User' and User modification forms but does not show in the Self registration form.
I added the following to FormMetaData.xml under the SelfRegistrationUserForm section:
<AttributeReference optional="false">USR_UDF_LOCATION</AttributeReference>
But, the Fiield is getting displayed as a text field and not a lookup field.
II read that Lookup/ Combo box field cannot be added in a self registration form. Is it true?
(Source:
Link: Adding combobox in self registration from
Link: OIM: problem with combobox in self registration form -
How can i update an existing item in sap using CSV file?
Hi,
i am trying to update an existing Item in SAP using a CSV file.
in the message log i get an error message that the item already exists.
what should i do in order to update the existing record?
Thanks, UdiHi..........
I would sugest you to use Tab delimited file and choose proper option in order to update the itsm master in DTW......
Regards,
Rahul -
Sorting on specific field using XSLT Mapping
Hi All,
I am trying to sort the records on specific field using XSLT mapping.But I'm unable get the proper output for the following code.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://xxxxxxxx">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<a:T1>
<Row>
<xsl:for-each select="a:S1/Record">
<xsl:sort select="EmpID" />
<EMPID>
<xsl:value-of select="EmpID"/>
</EMPID>
<ENAME>
<xsl:value-of select="EmpName"/>
</ENAME>
</xsl:for-each>
</Row>
</a:T1>
</xsl:template>
</xsl:stylesheet>>
Currently getting following output :
http://www.flickr.com/photos/21390012@N04/2074799747/
Expected output should be like below :
http://www.flickr.com/photos/21390012@N04/2074807393/
Kindly send me suggestion to achieve this.
Regards
PullaraoHi ,
I donno much about srting in XSLT but i can give you one example on that.
Example :
This is how to sort numbers in xslt.
Try this :
<xsl:for-each select="learn[@kind='done']">
<xsl:sort select="number(@rank)" data-type="number"/>
<table border="00" cellpadding="3" width="100%">
<tr>
<td width="100" valign="top" align="right"><input type="checkbox" checked="checked" readonly="readonly"/></td>
<td width="10" valign="top" align="right"><xsl:value-of select="position()"/>. </td>
<td valign="top">
[<xsl:value-of select="@rank"/>] <xsl:value-of select="@title"/>
</td>
</tr>
</table>
<table border="00" cellpadding="3" width="100%">
<tr>
<td width="100"> </td>
<td valign="top">
<xsl:apply-templates/>
</td>
</tr>
</table>
</xsl:for-each>
Regards
Aashish Sinha
PS : reward points if helpful -
Hi.
I am getting below error while adding value to look-up field.
Invalid data has been used to update the list item. The field you are trying to update may be read only.
I have tried many forums ans post but didn't come to know what's the root cause of issue. I am also posting Code for creating and adding lookup field.
CAML to create lookup field (It works Fine)
string lkproductNumber = "<Field Type='Lookup' DisplayName='Product Number' StaticName='ProductNumber' ReadOnly='FALSE' List='" + pNewMaster.Id + "' ShowField='Product_x0020_Number' />";
Code to insert value to lookup field
ClientContext client = new ClientContext(SiteUrl);
client.Load(client.Web);
client.Credentials = new NetworkCredential(this.UserName, this.Password, this.Domain);
// Lookup Lists
List pmList = client.Web.Lists.GetByTitle("Product_Master");
//List Conatining Lookup Columns
List piList = client.Web.Lists.GetByTitle("Product_Inventory");
client.Load(piList);
query.ViewXml = "<View/>";
ListItemCollection collection = pmList.GetItems(query);
client.Load(collection);
client.ExecuteQuery();
int prodid=0;
foreach (ListItem item in collection)
if (Convert.ToString(item["Product_x0020_Number"]) == ProductNumber)
{ prodid = Convert.ToInt32(item["ID"]); }
ListItem piItem = piList.AddItem(new ListItemCreationInformation());
piItem["Product_x0020_Number"] = new FieldLookupValue() { LookupId = prodid };
piItem.Update();
client.ExecuteQuery();
Exception Detail
Microsoft.SharePoint.Client.ServerException was caught
Message=Invalid data has been used to update the list item. The field you are trying to update may be read only.
Source=Microsoft.SharePoint.Client.Runtime
ServerErrorCode=-2147352571
ServerErrorTypeName=Microsoft.SharePoint.SPException
ServerStackTrace=""
StackTrace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at WebServiceProviders.ClientServices.NewProductInventory() in Z:\.............ClientServices.cs:line 889
InnerException:
Quick response is highly appreciated.
Thanks
MeharTry some thing like below,
your data value that needs to be update should be in this format "ID of the lookup";#"Title of the Lookup"
For example,
listItem["Product_x0020_Number"]
= "1;#iPhone";
listItem["Product_x0020_Number"]
= "2;#Mobile";
Hope this helped you....
Maybe you are looking for
-
How can I transfer my I-tunes account to a new PC
How can I transfer my I-tunes account to a new PC?
-
if i go into icloud on my phone then manage storage, i can see i have a 252.6 back up from my old iphone 5 (that i have now lost) i want to use this backup to get all my photos back but when i click on it, it says Latest back up Incomplete???????? am
-
It never used to disconnect so frequently or quickly. It is extremely annoying. Why does it suddenly keep disconnecting with this new update?
-
Straightening pictures in iPhoto '08, 7.1.3
Whenever I use the straightening tool, the picture softens and remains so regardless of how long I wait for it to be processed. All other adjustments I make have no effect on picture sharpness. This has only happened since upgrading to the MacBook 2.
-
I have a SP that runs everynight to Insert and Update the content of a table based on an excel file (Excel 2010 on Windows Server 20008 R2). Below is my SP and the image represents my table's structure and the excel file format. I just need to double