I'm not familiar with YAMS, but it looks like you need to run the YAMS snippet from within your code.
You should be able to do something like this:
$result = $modx->runSnippet('YAMS', array(
'docid' => $fromId,
// other parameters here
));
Consult the YAMS snippet documentation for a list of parameters to include.