Page tree
Skip to end of metadata
Go to start of metadata

Maybe you create a custom relation, different from the “get_related_list” function, in your module and wants to set this relation also by the Workflow Designer.
If you already added the relation, you know, every relation especially the relations with custom queries, are not able to handle in a similar way.

That’s why I add one interface to add custom relations to Workflow Designer in an upgrade safe way.

Add a file <filename>.inc.php to the folder modules/Workflow2/extends/relation_add/
The file mostly is not very big and must have the following structure:

namespace Workflow\Plugins\RelationAddExtend;

class <CustomUniqueRelationName> extends \Workflow\RelationAddExtend {

     * @param $sourceRecordId ID of Source Record
     * @param $targetRecordId ID of Record to Link
     * @return bool
    public function addRelatedRecord($sourceRecordId, $targetRecordId) {
       // Add your relation here

        return true;


\Workflow\RelationAddExtend::register(str_replace('.inc.php', '', basename(__FILE__)), '\\Workflow\\Plugins\\RelationAddExtend\\<CustomUniqueRelationName>');

You only need to set a UniqueRelationName, which is not related to the configured relation in vtiger, and add your custom code to add the relation in database.

  • No labels