I'm not sure about the syntax to do it in parts, but this seems to work:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Drug.jmp" );
obj = dt << Fit Model(
Y( :y ),
Effects( :Drug, :x ),
Personality( Standard Least Squares ),
Run Model()
);
obj << Profiler(1, Desirability Functions(1), Save Desirability Formula);
First you have to create profiler, then enable desirability functions and finally save the formula.
-Jarmo