is there another solution?
# suitescript
p
is there another solution?
e
Not a supported/official one, no. Client Scripts are not intended to fire on View mode, and Client Script event triggers like
pageInit
do not fire in View mode.
p
yea this im aware of. i dont mind a hack but a hack where i can insert code as code and not as a string
b
Form.clientScriptModulePath works on view too. no entry point triggers,
p
does it?
seems to not work with my code
i need to add inline hack
the form does not work.
b
what code did you try?
p
Copy code
/**
 *@NApiVersion 2.x
 *@NScriptType UserEventScript
 */
define(['N/record',
        'N/ui/serverWidget'],
    function () {
        function beforeLoad(context) {
            if (context.type === context.UserEventType.VIEW) {
                context.form.clientScriptModulePath = "path";
            }
        }

        return {
            beforeLoad: beforeLoad
        };
    });
and created a client script that would modify dom elements
b
and the script at path?
p
its the client script
b
you can just make it do an alert to see that it runs
p
i just used path to not display my awesome directory sorting
i tried that as well and it didnt work
can you show me your scripts
id prefer this way rather then using jquery
b
Copy code
define([], function() {
  alert('i was added in beforeLoad')
});
p
thats the client?
b
its exactly what you would think is required
yes
p
so i created a function within
b
then you need something to call the function
there are no suitescript entry points to do that for you
p
Copy code
define([],
    function () {

        function sizeAssortmentSublistCustomizations() {
            alert("hello")
            }

        return {
            sizeAssortmentSublistCustomizations: sizeAssortmentSublistCustomizations
        };
    });
this is what i had
b
unless you have a button whose functionName is sizeAssortmentSublistCustomizations
that does nothing
p
ah ok so this was my issue
thanks! will try your way
still a newbie to this
thanks man, worked!