Hi all, I created a button on Item Fulfillments, t...
# suitescript
r
Hi all, I created a button on Item Fulfillments, the click of which opens a popup with some header values and sublist fields using a Suitelet. Is there any way we can have a similar button on each line level item of the IF? I see we can create a custcol checkbox but anyways can we create a button here on the line level? Thanks
m
Without DOM manipulation the best you'll get is using a checkbox as a button.
n
You can create a suitelet and add that as a hyperlink dynamically on the sublist in view mode. So when a user clicks on it the suitelet is passed the relevant details of that line and the record, no need for funky dom manipulation.
m
Yup you can in view mode sorry I assumed edit mode.
r
Thank you. But what am I doing wrong here? I don't see the button on line level. There is no error in the logs.
Copy code
var form = context.form,
    itemSublist = form.getSublist({ id : 'item' });

for(var i = 0; i < numLines; i++) {
    var itemId = ifRec.getSublistValue({ sublistId: 'item', fieldId: 'item', line: i }),
        itemName = ifRec.getSublistText({ sublistId: 'item', fieldId: 'item', line: i });
    log.debug(title, 'itemId: ' + itemId + ', itemName: ' + itemName);

    var cwLineUrl = processCwDetURL(ifId, ifNum),
        cwDetailsBtnId = 'custpage_cw_details_btn' + i;
    log.debug(title, '**cwLineUrl: ' + cwLineUrl);
    itemSublist.addButton({
        id : cwDetailsBtnId,
        label : LABEL_TOKENS.cwDetail,
        functionName: cwLineUrl
    });
    log.debug(title, 'Line Button Added');
}
processCwDetURL creates the Suitelet Url
n
You're trying to add a button, that's where you're going wrong. I said hyperlink, more specifically, it might have been a custom column (text) set as inline or rich text I used, been a while, but definitely not a button.
If I get time I might be able to dig out some old code if you get stuck, but do try yourself first 😉
r
Sure, thank you so much. Will check this solution 🙂