Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
widget personalizado en el portal de servicio: la variable del script del servidor no se puede leer desde el script del cliente

Estoy completando un objeto con información del país en la secuencia de comandos del servidor de mi widget personalizado e intento leerlo desde la secuencia de comandos del cliente.

Guión del servidor:

 data.vendorCountry = {}; if (input.existingvendor) { getVendor(input.existingvendor); } function getVendor(vnd) { var gr = new GlideRecord('u_vendors'); gr.addQuery('sys_id', vnd); gr.query(); if (gr.next()) { data.newVendor.name = gr.getValue('u_name'); data.newVendor.street = gr.getValue('u_street'); data.newVendor.city = gr.getValue('u_city'); data.newVendor.zip = gr.getValue('u_zip'); data.newVendor.billingid = gr.getValue('u_billing_id'); data.newVendor.invoiceid = gr.getValue('u_invoiceid'); data.newVendor.country = gr.getDisplayValue('u_country'); // get the country name and sys_id for the existing vendor var grVendorCountry = new GlideRecord('core_country'); grVendorCountry.addQuery('name', data.newVendor.country); grVendorCountry.query(); if(grVendorCountry.next()) { data.vendorCountry = grVendorCountry; console.log(data.vendorCountry); } } }

Guión del cliente:

 $scope.vendorselection= function(val) { c.data.action = 'submit'; c.data.existingvendor = val; c.server.update().then(function() { if(c.data.vendorCountry){ $scope.country = { displayValue: c.data.vendorCountry.name, value: c.data.vendorCountry.sys_id, name: 'location' }; console.log(c.data.vendorCountry); } }); }

Resultado de console.log(data.vendorCountry); es un objeto adecuado con información del país como name , sys_id

Resultado de console.log(c.data.vendorCountry); es [object Object]

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La razón por la que esto sucede es porque si hace un console.log dentro de la secuencia de comandos del servidor, se llamará a toString en el país del proveedor. El script del servidor no puede iniciar sesión directamente en la consola de javascript en el navegador, puede hacer console.log(JSON.stringify(c.data.vendorCountry)) pero le aconsejo que use $sp.log(c.data.vendorCountry) dentro de la secuencia de comandos del servidor para iniciar sesión.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!