附加文件以记录在NetSuite中

发布于 2025-01-24 00:24:30 字数 238 浏览 3 评论 0原文

我正在将附件从Zoho转移到Netsuite。但是,将问题附加到机会或任何其他对象时面临问题。我已经将文件上传到NetSuite的文件柜中,并试图将其与记录注释绑定。但这不起作用。它仅将注释添加到记录中,但没有文件选项中的任何文件符号。

谢谢。 在此处输入图像描述

I am transferring attachments from Zoho to Netsuite. But facing problems while attaching it to opportunity or any other object. I have already uploaded the file to the file cabinet in netsuite and tried to bind it with the records notes. But that doesn't work. It only adds the note to the record but no sign of any file in the file option.

Thank you.
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

是伱的 2025-01-31 00:24:30

您将使用record.attach函数。您需要文件的内部ID和交易的内部ID。在SS1(使用nlapiattachrecord)中,首先列出文件参数很重要。 SS2语法更清晰:

record.attach({
    record:{
        type:'file',
        id:fileid
    },
    to:{
        type:'transaction', 
        id:transactionid
    }
});

You would use the record.attach function. You would need the internal id of the file and of the transaction. In SS1 (using nlapiAttachRecord) it was important to list the file arguments first. The SS2 syntax makes that clearer:

record.attach({
    record:{
        type:'file',
        id:fileid
    },
    to:{
        type:'transaction', 
        id:transactionid
    }
});
月光色 2025-01-31 00:24:30
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
*/

/**
* In this I am using Map Reduce script to process & attach multiple files from 
* FileCabinet of NetSuite. So that it never goes out of governance.
/
define(['N/record','N/query'],
(record,query) => {
  const getInputData = (getInputDataContext) => {

    try
    {
      /**
      * Query for getting transaction ID & other header detail of record.
      */
      let transQuery = "SELECT custrecord_rf_tid as tid, custrecord_rf_fid as fid, id FROM customrecord_rflink where custrecord_rf_comp <> 'T' and custrecord_rf_type = 11";
      let transQueryResult = runSuiteQuery(transQuery);

      if(transQueryResult.length > 0){
        log.debug("Count of record left to process--->", transQueryResult.length);
        return transQueryResult;
      }else{ //Incase where no transaction was left to transform.
        log.debug({title: "No Remaining Transaction!"});
        return 1;
      }
    }
    catch (e)
    {
      log.error({title: "Error inside getinput data.", details: [e.message,e.stack]});
    }
  }

 
  const map = (mapContext) => {
    try{
      let mapData = JSON.parse(mapContext.value);
      log.debug({title: "mapData after parse", details: mapData});

      let staginRecId = Number(mapData.id);
      let fileId = Number(mapData.fid);
      let billId = Number(mapData.tid);

      let outputVal = attachfile('file',fileId, 'inventoryadjustment', billId);

      let staginRec;
      if(outputVal === true){
        staginRec = record.submitFields({
          type: 'customrecord_rflink',
          id: staginRecId,
          values: {
            'custrecord_rf_comp': true
          }
        });
        log.debug("record saved with id-->", staginRecId);
      }else{
        log.debug("record saving failed with id-->", staginRecId);
      }


    }
    catch(e){
      log.error({title: "Error in Map", details: [e.message,e.stack]});
    }
  }   

  const reduce = (reduceContext) => {

  }

  const summarize = (summarizeContext) => {
    log.debug('Summarize completed');
  }

  function runSuiteQuery(queryString) {
    log.debug("Query", queryString);
    let resultSet = query.runSuiteQL({
      query: queryString
    });
    log.debug("Query wise Data", resultSet.asMappedResults());
    if(resultSet && resultSet.results && resultSet.results.length > 0) {
      return resultSet.asMappedResults();
    } else {
      return [];
    }
  }
  function attachfile(recType, recId, recTypeTo, recIdTo) {
    record.attach({
      record: {
        type: recType,
        id: recId
      },
      to: {
        type: recTypeTo,
        id: recIdTo
      }
    });

    return true;
  }
  return {getInputData,map,reduce,summarize};
});
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
* @NModuleScope SameAccount
*/

/**
* In this I am using Map Reduce script to process & attach multiple files from 
* FileCabinet of NetSuite. So that it never goes out of governance.
/
define(['N/record','N/query'],
(record,query) => {
  const getInputData = (getInputDataContext) => {

    try
    {
      /**
      * Query for getting transaction ID & other header detail of record.
      */
      let transQuery = "SELECT custrecord_rf_tid as tid, custrecord_rf_fid as fid, id FROM customrecord_rflink where custrecord_rf_comp <> 'T' and custrecord_rf_type = 11";
      let transQueryResult = runSuiteQuery(transQuery);

      if(transQueryResult.length > 0){
        log.debug("Count of record left to process--->", transQueryResult.length);
        return transQueryResult;
      }else{ //Incase where no transaction was left to transform.
        log.debug({title: "No Remaining Transaction!"});
        return 1;
      }
    }
    catch (e)
    {
      log.error({title: "Error inside getinput data.", details: [e.message,e.stack]});
    }
  }

 
  const map = (mapContext) => {
    try{
      let mapData = JSON.parse(mapContext.value);
      log.debug({title: "mapData after parse", details: mapData});

      let staginRecId = Number(mapData.id);
      let fileId = Number(mapData.fid);
      let billId = Number(mapData.tid);

      let outputVal = attachfile('file',fileId, 'inventoryadjustment', billId);

      let staginRec;
      if(outputVal === true){
        staginRec = record.submitFields({
          type: 'customrecord_rflink',
          id: staginRecId,
          values: {
            'custrecord_rf_comp': true
          }
        });
        log.debug("record saved with id-->", staginRecId);
      }else{
        log.debug("record saving failed with id-->", staginRecId);
      }


    }
    catch(e){
      log.error({title: "Error in Map", details: [e.message,e.stack]});
    }
  }   

  const reduce = (reduceContext) => {

  }

  const summarize = (summarizeContext) => {
    log.debug('Summarize completed');
  }

  function runSuiteQuery(queryString) {
    log.debug("Query", queryString);
    let resultSet = query.runSuiteQL({
      query: queryString
    });
    log.debug("Query wise Data", resultSet.asMappedResults());
    if(resultSet && resultSet.results && resultSet.results.length > 0) {
      return resultSet.asMappedResults();
    } else {
      return [];
    }
  }
  function attachfile(recType, recId, recTypeTo, recIdTo) {
    record.attach({
      record: {
        type: recType,
        id: recId
      },
      to: {
        type: recTypeTo,
        id: recIdTo
      }
    });

    return true;
  }
  return {getInputData,map,reduce,summarize};
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文