This topic contains 2 replies, has 0 voices, and was last updated by Armin 7 years, 9 months ago.
-
AuthorPosts
-
January 27, 2017 at 2:04 pm #6484
ArminHello NetSuite Developers Community!
I am here to introduce myself as a developer (php, c#, html/css, javascript/jquery/ajax/json, python). I am seeking friends to exchange ideas and knowledge. Bellow you may find one situation that I am facing at the moment.
I am exploring the functionalities of SuiteTalk using PHP. The biggest problem that I always face with it is no useful error return in the debug, something that I can actually understand why something is going wrong, why X variable isn’t accepting value Y, and etc. So far, I am using Eclipse IDE with xDebug set in it, allowing me to debug step by step the code; once I face an error, there not much that I can do to figure out if it is a syntax error, reference error, or something else, etc. The final project will be deployed in PHP, but I am considering develop its backend in C# just to catch how SuiteTalk deals with NetSuite content.
I am trying to get an array/list of the values inside of a custom field that lays inside of a custom task form.
The main goal here is to develop a html page to replace that custom task form. It already exists and is working on NetSuite UI. I was able to create a new task with SuiteTalk PHP Toolkit, referencing the internal-id of it, but I am having a hard time to get the content list of every drop box field existent in the form. I need those lists in order to be able to draw them later in html (using
- ). Once the user then select one these items from my html page, then I will run a new php to collect the selected data from the html and create the new task in the backend.
Below is where I am getting stuck with:
PHP Code:
require_once ‘PHPToolkit/NetSuiteService.php’;
$service = new NetSuiteService();$fieldDesc = new GetSelectValueFieldDescription();
$fieldDesc->customRecordType = new RecordRef();
$fieldDesc->customRecordType->internalId = 370;
$fieldDesc->customRecordType->type = RecordType::customRecord;$requestValue = new getSelectValueRequest();
$requestValue->fieldDescription = $fieldDesc;$service->getSelectValue($requestValue);
I am basing my coding in the Java sample that I found in this page: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_N3504236.html#bridgehead _N27161241
Ok, Let me give you more details about the structure of the form:
So, there is a default Task Form in NetSuite, right. Instead of that one, I have a Custom Entry Form for Tasks named “Reliance Task Form” with id “custform_31_634698_788”, internal-id 30, and type CRM.
This custom form has several customized fields. There is a Custom CRM Field named “Task Project” that has the label “PROJECTS” when it is displayed. It has the id “custevent_task_project”, internal-id 370, and it receives its lists of options (dropdown content) from a Custom Record [RecordType] labeled as “Projects”. This CustomRecordType has id “customrecord65” and internal-id 65. As I mentioned before, I would like to get an array of the items inside of that custom field or custom record, and then later create a task using SuiteTalk sending the option selected by the user.
I noticed that what is display as ID being a string/text in NetSuite UI is also know (treated) as script-id by SuiteTalk.
Below you may see a screenshot of the Custom Task and its Custom Fields on NetSuite: Image Link
I managed to successfully tell SuiteTalk to use a specific custom form when creating the task:
PHP Code:
// creates an object Task
$task = new Task();//Sets the customForm that we want to use “Reliance Task Form” – Listed on [Custom Entry Forms] page:
// https://system.netsuite.com/app/common/custom/custentryforms.nl?whence=
$task->customForm = new RecordRef();//Either one will work
$task->customForm->internalId = 30;
//$task->customForm->scriptId = “custform_31_634698_788”;I really will appreciate if someone could assist me.
Thanks,
Armin
This is a cached copy. Click here to see the original post. - ). Once the user then select one these items from my html page, then I will run a new php to collect the selected data from the html and create the new task in the backend.
-
January 30, 2017 at 12:42 pm #6485
ArminI guess that I just solved part of my own problem haha.
I was able to set a specific value from its options to that custom field!!
Here is the code for it:
PHP Code:
//Define which option I want to choose from the custom list “Projects” directly
//in this case, id 35 means the option “Marketing”
$custSelectValue = new ListOrRecordRef();
$custSelectValue->internalId = 35;
$selectCustomFieldRef = new SelectCustomFieldRef();
$selectCustomFieldRef->value = $custSelectValue;//Here I set the string ID of the custom field present inside of the custom form.
$selectCustomFieldRef->scriptId = “custevent_task_project”;//The request->customFieldList only receives array, so I had to do like that
$task->customFieldList = new CustomFieldList();
$task->customFieldList->customField = array($selectCustomFieldRef);I based my code in the c# sample found in:
https://system.netsuite.com/app/help…ead_4514853692
Now I am working on how to pull out the data from Projects list haha.
Thanks
-
January 30, 2017 at 2:17 pm #6486
ArminHow can I fix this SOAP error, please!
I am using the sample for the getSelectValue found at:
https://system.netsuite.com/app/help…head_N27161241
But, I am getting a error from SOAP now saying that there is no getSelectValue operation available, bellow is the error complete:
PHP Code:
Fatal error: Uncaught SoapFault exception:
[Server.userException] No such operation ‘getSelectValue’ in
D:ProgramsxampphtdocsSuiteTalkPHPToolkitNSPHPClient.php on line 339SoapFault: No such operation ‘getSelectValue’ in
D:ProgramsxampphtdocsSuiteTalkPHPToolkitNSPHPClient.php on line 339Bellow you may find how my code looks like after converting from the Java sample to PHP:
PHP Code:
$myFilterByValue = new GetSelectFilterByFieldValue();
$myFilterByValue->sublist = null;
$myFilterByValue->field = “entity”;
$myFilterByValue->internalId = 8;$myFilterByList = new GetSelectFilterByFieldValueList();
$myFilterByList = array($myFilterByValue);$myGSVField = new GetSelectValueFieldDescription();
$myGSVField->recordType = RecordType::salesOrder;
$myGSVField->customRecordType = null;
$myGSVField->customTransactionType = null;
$myGSVField->sublist = “itemList”;
$myGSVField->field = “item”;
$myGSVField->customForm = null;
$myGSVField->filter = null;
$myGSVField->filterByValueList = $myFilterByList;$valueRequest = new getSelectValueRequest();
$valueRequest->fieldDescription = $myGSVField;$br = new getSelectValueResponse();
$br = $service->getSelectValue($valueRequest);How can I fix this SOAP error, please!
-
AuthorPosts
You must be logged in to reply to this topic.