Selecting the customer field in weekly timesheet, based on customer related i need to populate project list in sublist. Can you give me solution pls.

 

Selecting the customer field in the weekly timesheet, based on customer-related I need to populate project list in the sublist. Can you give me a solution pls?

 

 

Below script I wrote for this…but script is not working.

 

I think because of this below APIs.

 

nlapiRemoveLineItemOption(‘timeitem’, ‘customer’);
nlapiInsertLineItemOption(‘timeitem’, ‘customer’, ”, ”, true);

 

can you help me please any one.

//////////////////////////////////////////////////////////////////////////////////

 

 

 

function projectListBasedOnCustomer(type, name) {

try {
if (name == ‘custrecord6’) {
var customer = nlapiGetFieldValue(‘custrecord6’); //customer field
alert(‘customer ‘ + customer);

var jobSearch = nlapiSearchRecord(“job”, null,
[
[“customer”, “anyof”, customer]
],
[
new nlobjSearchColumn(“entityid”).setSort(false),
new nlobjSearchColumn(“altname”),
new nlobjSearchColumn(“customer”),
new nlobjSearchColumn(“companyname”)
]);
alert(‘project customer’ + jobSearch);

nlapiRemoveLineItemOption(‘timeitem’, ‘customer’);
nlapiInsertLineItemOption(‘timeitem’, ‘customer’, ”, ”, true);

for (var i = 0; jobSearch != null && i < jobSearch.length; i++) {
var id = jobSearch[i].getId();
alert(‘id’ + id);
var name = jobSearch[i].getValue(‘companyname’);
alert(‘name’ + name);
nlapiInsertLineItemOption(‘timeitem’, ‘customer’, id, name); //populate the sublist select field with options
}

}
} catch (e) {
nlapiLogExecution(‘Error’, ‘projectListBasedOnCustomer’, e);

}

}

Rookie Asked on September 23, 2019 in SuiteScript.
Add Comment
1 Answer(s)

You cannot modify the values of a standard field. Further, as far as I can tell from your code, you are essentially trying to replicate native behavior. It appears that you are using a custom field for the customer selection. So, simply transfer the value of the custom customer field to the native customer field. NS will then filter using its native behavior.

Advanced Answered on September 24, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor