I'm looking to display the managers name (defined in AD for the user) in a column depending on a selection from another column. For example.
Column 1 - Employee Name
Column 2 - Department
Column 3 - Manager
Column 1 is populated with the employee name and saved. It's a "User or Group" type column
Column 2 is "Person or Group" column with the "Show Field" option set as department. I have a workflow that starts on a new entry that takes the column 1 data and applies it to Column 2 thus display the users department.
My issue is in the "Show Fields" option there is no manager selection. Is there a way to display this as a selection or is there another way for me to populate a users manager depending on the employee selection?
The other option I've tried is doing a 2010 workflow for "Find Manager of" current employee (output to variable:manager) and then to update the manager column to use the data from Variable manager but nothing seems to display.
enter image description here Perhaps I've done something wrong here though..
Any help would be appreciated.
Updated screenshot information
enter image description here
What is the data type of Manager column? Make it 'Person or Group'.
In the workflow, select return field as 'Login Name' and try. Below is the screen shot.
You can get all the three values on the New Form itself and then just save it.
Use SPServices jQuery. Just download the latest one. Below is the script.
<script type="text/javascript" src="/your path to JS/SiteAssets/JS/jquery-3.1.1.js"></script>
<script type="text/jscript" src="/your path to JS/SiteAssets/JS/jquery.SPServices.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var managerName;
var userName = $().SPServices.SPGetCurrentUser();
$().SPServices({
operation: "GetUserProfileByName",
async: false,
AccountName: userName,
completefunc: function (xData, Status)
{
managerName = $(xData.responseXML).text();
var managerLength = managerName.length;
var indexofManager = managerName.indexOf("ManagerPublic");
managerName = managerName.substring(indexofManager+13, managerLength);
var indexOffalse = managerName.indexOf("false");
managerName = managerName.substring(0, indexOffalse);
}
});
var UserDept = $().SPServices.SPGetCurrentUser({
fieldName: "Department",
debug: false
});
var CurrentUser = $().SPServices.SPGetCurrentUser({
fieldName: "Title",
debug: false
});
$("input[title*='Employee Name']").val(CurrentUser); // For assigning to SharePoint column named 'Employee Name'
$("input[title*='Department']").val(UserDept); // For assigning to SharePoint column named 'Department'
var Mgr = $().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "Manager", // For assigning to SharePoint column named 'Manager'
valueToSet: managerName,
checkNames: true
});
});
</script>
Related
Is it possible to have one select field depend on the previous one?
Users select one value from select_1 then accordingly the value in select_2 change. Maybe a custom formatter?
const newCol = {//create column group
title: oldRow.title,
field: oldRow.field,
columns: [
{
title: rowData.select1.title, field: rowData.select2.name, editor: 'select',
editorParams: {values: rowData.select1.values}
},
{
title: rowData.select2.title, field: rowData.select2.name, editor: 'select',
editorParams: function (cell) {
console.log(cell)
return {values: [1, 2, 3]}
}
},
],
}
From above I need select1 selected value.
Would this work Editors?:
"If you want to generate the options when the select editor is triggered, then you can pass a function into the editorParams, that must return the option list in one of the two formats outlined above"
{title:"Name", field:"name", editor:"select", editorParams:function(cell){
//create a options list of all values from another column in the table
var rows = table.getRows();
var values = {};
rows.forEach(function(row){
var data = row.getData();
values[data.fullname] = data.fullname;
});
return {values:values};
}
Instead of fetching the all the rows, just fetch the cell value of the previous select column and use that to build the choices for the current select. This sort of depends on the specifics of how the two columns relate to each other. More information on that would be helpful.
We loaded a SP list directly from an Access query and now when we try to run a list update with pnpjs I get an "Error code: -2130575163.List data validation failed" .
There are no required fields, no validation on any columns, and no Validation settings on the list. Is this not working because it was uploaded from Access?
Updating it similar to this:
const items = await sp.web.lists.getByTitle("MyList").items.top(1).filter("Title eq 'A Title'").get();
const updatedItem = await sp.web.lists.getByTitle("MyList").items.getById(items[0].Id).update({
my_id: mynewID,
})
Adding list items works with no issues. Updating a list item does not work.
Try this.
let list = sp.web.lists.getByTitle("MyList");
const i = await list.items.getById(1).update({
Title: "My New Title",
Description: "Here is a new description"
});
console.log(i);
Is items[0].Id valid ?
Please try to use console.log (items[0].Id) to check in Developer Tool.
I tested the same request in my side, my_id is a number field:
const items = await sp.web.lists.getByTitle("JqueryList").items.top(1).filter("Title eq 'My New Title'").get();
console.log(items);
let list = sp.web.lists.getByTitle("JqueryList");
const i = await list.items.getById(items[0].Id).update({
Title: "My New Title",
my_id: 1
});
I did resolve it - when you use the StrReverse function in Access and then upload that query to a SP list - the list type is corrupted.
To fix it I simply went in and changed the type from single line text to multiline - then back to single line of text.
I was then able to update the list item.
I have two lists:
Clientes-Canal: TITLE
Clientes-Subsegmentacion: TITLE - CANAL (Lookup to Clientes-Canal)
Clientes: where I save all the information
My code:
$(document).ready(function () {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Clientes-Subsegmentacion",
relationshipListParentColumn: "Clientes-Canal",
relationshipListChildColumn: "Title",
parentColumn: "Canal",
childColumn: "Subsegmentacion",
debug: true
});
});
In my Clientes' list I have two columns, Canal (Lookup to Clientes-Canal), and Subsegmentacion (Lookup to Clientes-Subsegmentacion)
But it's not working.
Error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Here are the docs:
relationshipList The name or GUID of the list which contains the
parent/child relationships. If you choose to use the GUID, it should
look like: "{E73FEA09-CF8F-4B30-88C7-6FA996EE1706}". Note also that if
you use the GUID, you do not need to specify the relatedWebURL if the
list is in another site.
relationshipListParentColumn The StaticName of the parent column in
the relationshipList
relationshipListChildColumn The StaticName of the child column in the
relationshipList
parentColumn The DisplayName of the parent column in the form
childColumn The DisplayName of the child column in the form
So, in your case:
$(document).ready(function(){
$().SPServices.SPCascadeDropdowns({
relationshipList: "Clientes-Subsegmentacion",
relationshipListParentColumn: "Canal",
relationshipListChildColumn: "Title",
parentColumn: "Canal",
childColumn: "Subsegmentacion",
debug: true
});
});
Make sure you don't have spelling mistakes, you can also try using Id of your Clientes-Subsegmentacion list.
Take a look at my answer here on similar question if my answer doesn't help you.
I am using SuiteScript 2.0 in Netsuite. The list of countries are available in
Setup > Company > Countries. As of current version, I have not found a way to get list of Countries and State/Province drop downs added in custom Suitelets.
How Can I access this list from Netsuite Suitescripts?
There could be a more direct way to do this, but you can begin creating a customer record, access the address object and get the select options that are available.
var custRec = record.create({ type: record.Type.CUSTOMER, isDynamic: true });
var custSubrec = custRec.getCurrentSublistSubrecord({ sublistId: 'addressbook', fieldId: 'addressbookaddress' });
var countryFieldObj = custSubrec.getField({ fieldId: 'country' });
var countryList = countryFieldObj.getSelectOptions();
There is no module or enumeration anywhere for this. SuiteScript uses the ISO-standard two-letter (ALPHA-2) country codes. http://www.nationsonline.org/oneworld/country_code_list.htm
Create a Saved Search for customer Record named customsearch_customercountry where criteria is empty and Results contains the fields you want (including country by example). The saved search will be loaded and include the filter using the customerId as variable taken or filled from your code previous sentences.
the script will be as:
var country_search = search.load({
id: "customsearch_customercountry",
});
var filterArray = [];
filterArray.push(["internalid", "is", customerId]);
country_search.filterExpression = filterArray;
var searchResult = country_search.run().getRange({
start: 0,
end: 1,
});
log.debug({
title: "Execute Search ",
details: "ResultSet length: " + searchResult.length,
});
if (searchResult.length > 0) {
var country = searchResult[0].getText({
name: "Country",
});
log.debug({
title: "Execute Search ",
details: "ResultSet found with country: " + country,
});
}
NOTE: you must use the .getText() function to retrieve the text value for the country Result. If you only need the Country code, use .getValue() instead of
I'm writing a code , so that I can change column's editor manually . I'm able to set editor event on double click event ('dblClick') .
When I click on cell, effect is observe on next click .
What is missing ?
Or
How can open/show editor manually ?
My code is like .......
table.delegate('dblclick', function(e) {
var target = e.currentTarget;
var model = table.getRecord(target.get('id'));
var type = model.get('type');
var column = this.get('columns.value');
column.editor = editors[type];
this.showCellEditor(target);
},'tr', table);
this.showCellEditor(target); --> this method is of YUI (Yahoo's UI) . Is any method is resemble to this one in Alloy UI ?
Instead of selecting an editor on the fly, why not group similar data in the same column so that the same editor can be used?
var columns = [{
editor: new Y.TextAreaCellEditor(),
key: 'name'
}, {
editor: new Y.DateCellEditor({
dateFormat: '%m/%d/%Y'
}),
key: 'birthday'
}];
If you group the data like that, then you can change the editEvent of the dataTable to dblclick like so:
var dataTable = new Y.DataTable({
// ...
editEvent: 'dblclick'
}).render('#dataTable');
Here is a working example:
YUI().use('aui-datatable', function(Y) {
var columns = [{
editor: new Y.TextAreaCellEditor(),
key: 'name'
}, {
editor: new Y.DateCellEditor({
dateFormat: '%m/%d/%Y'
}),
key: 'birthday'
}];
var data = [{
birthday: '9/9/1999',
name: 'Jonathan Smithy'
}, {
birthday: '10/10/1990',
name: 'Bob Duncan'
}];
var dataTable = new Y.DataTable({
columnset: columns,
recordset: data,
editEvent: 'dblclick'
}).render('#dataTable');
});
<script src="https://cdn.rawgit.com/stiemannkj1/701826667a70997013605edcd37e92a6/raw/469fe1ae297e72a5a80eb9015003b7b04eac735e/alloy-ui-3.0.1_aui_aui-min.js"></script>
<link href="https://cdn.rawgit.com/stiemannkj1/90be22de7f48c729b443af14796d91d3/raw/a9f35ceedfac7fc0559b121bed105eaf80f10bf2/aui-css_css_bootstrap.min.css" rel="stylesheet"></link>
<div id="dataTable"></div>
If you must dynamically choose and display the editor, I'd recommend taking a look a the getEditor(record, column) method of A.DataTable.CellEditorSupport. I was unable to get getEditor() to work, but I'd assume that if you can get it working, you could do something like getEditor(data[1], column[0]).show().