Netsuite 客户中心:输入订单 - 客户无条件提交发票
Netsuite Customer Center: Enter an Order - Customers submitting invoices without terms
有些客户有条款,有些则没有。在我们的客户中心(我的帐户部分),有一个 link 到 "Enter an Order",它默认显示发票表单,因为我将发票表单设置为首选销售订单(外部)表单。
然而,这似乎是为每个人显示发票表格,无论他们是否有条款。
我想要的行为是:当有条款的客户单击 "Enter an Order" link 时,它会向他们显示发票订单。当没有条款的客户单击 "Enter an Order" link 时,它会向他们显示信用卡订单。
有办法吗?
是的,但这有点麻烦。
基本上,您创建两个链接以在您的客户中心输入订单。每个都一样,除了一个有 &cf=<internalidoftermsform>
然后在您的主题中添加一个新标签,例如 <TAB_EXTRA_FOOTER>
,标签定义中为空白
然后在“我的帐户”选项卡上用类似以下内容覆盖该标签:
<script type="text/javascript">
(function($){
var custTerms ="<%=getCurrentAttribute('customer', 'terms', '')%>";
$("a...).hide(); // filter out and hide the wrong link. Or just add the cf param to the existing link
})(jQuery);
</script>
基本思想是只使用注入的脚本来调整链接,以便出现正确的链接。
实际上,您也可以使用加载前用户事件脚本来做同样的事情。我忘了这个(几年前第一次做)
- 创建销售订单用户事件脚本。
为 beforeLoadEvent 设置如下脚本:
function beforeLoad(type, myForm, req) {
if (type == 'create' && nlapiGetContext().getRoleCenter() == 'CUSTOMER') {
if(nlapiGetFieldValue('entity')){// shouldn't be here if no entity
var hasTerms = nlapiLookupField('customer', nlapiGetFieldValue('entity'), 'terms');
var ccFormId = nlapiGetContext().getSetting('SCRIPT', 'custscript_default_custcenter_cash_form');
var invFormId = nlapiGetContext().getSetting('SCRIPT', 'custscript_default_custcenter_inv_form');
var neededFormId = hasTerms ? invFormId : ccFormId;
if (req && !req.getParameter('cf') && neededFormId != nlapiGetFieldValue('customform')) {
nlapiLogExecution('DEBUG', 'sHould redirect to invoice form');
nlapiSetRedirectURL('RECORD', nlapiGetRecordType(), nlapiGetRecordId(), (type == 'create'), { cf: neededFormId });
}
}
}
}
有些客户有条款,有些则没有。在我们的客户中心(我的帐户部分),有一个 link 到 "Enter an Order",它默认显示发票表单,因为我将发票表单设置为首选销售订单(外部)表单。
然而,这似乎是为每个人显示发票表格,无论他们是否有条款。
我想要的行为是:当有条款的客户单击 "Enter an Order" link 时,它会向他们显示发票订单。当没有条款的客户单击 "Enter an Order" link 时,它会向他们显示信用卡订单。
有办法吗?
是的,但这有点麻烦。
基本上,您创建两个链接以在您的客户中心输入订单。每个都一样,除了一个有 &cf=<internalidoftermsform>
然后在您的主题中添加一个新标签,例如 <TAB_EXTRA_FOOTER>
,标签定义中为空白
然后在“我的帐户”选项卡上用类似以下内容覆盖该标签:
<script type="text/javascript">
(function($){
var custTerms ="<%=getCurrentAttribute('customer', 'terms', '')%>";
$("a...).hide(); // filter out and hide the wrong link. Or just add the cf param to the existing link
})(jQuery);
</script>
基本思想是只使用注入的脚本来调整链接,以便出现正确的链接。
实际上,您也可以使用加载前用户事件脚本来做同样的事情。我忘了这个(几年前第一次做)
- 创建销售订单用户事件脚本。
为 beforeLoadEvent 设置如下脚本:
function beforeLoad(type, myForm, req) { if (type == 'create' && nlapiGetContext().getRoleCenter() == 'CUSTOMER') { if(nlapiGetFieldValue('entity')){// shouldn't be here if no entity var hasTerms = nlapiLookupField('customer', nlapiGetFieldValue('entity'), 'terms'); var ccFormId = nlapiGetContext().getSetting('SCRIPT', 'custscript_default_custcenter_cash_form'); var invFormId = nlapiGetContext().getSetting('SCRIPT', 'custscript_default_custcenter_inv_form'); var neededFormId = hasTerms ? invFormId : ccFormId; if (req && !req.getParameter('cf') && neededFormId != nlapiGetFieldValue('customform')) { nlapiLogExecution('DEBUG', 'sHould redirect to invoice form'); nlapiSetRedirectURL('RECORD', nlapiGetRecordType(), nlapiGetRecordId(), (type == 'create'), { cf: neededFormId }); } } }
}