Announcement

Collapse
No announcement yet.

Change Team by formula

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • shalmaxb
    commented on 's reply
    There was still one small issue in the formula above. When the team changed, it showed up as the ID and only in real name after refreshing the page.
    One change in the formula solves this:

    ifThen(
    verkauft == true,
    entity\addLinkMultipleId('teams', 'put here the real name of the team: e.g.: verkauft');
    entity\removeLinkMultipleId('teams', '5f04e5fd2ada48a70')
    );
    ifThen(
    verkauft == false,
    entity\addLinkMultipleId('teams', 'put here the real name of the team: e.g.: nicht verkauft');
    entity\removeLinkMultipleId('teams', '5f05a205c55b648ac')
    );

  • Maximus
    replied
    Right. Also you can utilize:
    verkauft instead of verkauft == true
    !verkauft instead of verkauft == false

    Leave a comment:


  • shalmaxb
    replied
    Hi Maximus, you got me on the right track and now it is working as desired. Here my formula for this:

    Code:
    ifThen(
    verkauft == true,
    entity\addLinkMultipleId('teams', '5f05a205c55b648ac');
    entity\removeLinkMultipleId('teams', '5f04e5fd2ada48a70')
    );
    ifThen(
    verkauft == false,
    entity\addLinkMultipleId('teams', '5f04e5fd2ada48a70');
    entity\removeLinkMultipleId('teams', '5f05a205c55b648ac')
    );
    This makes, that the record is taken from one team to another, if checked and vice versa, when unchecked.
    Thank you for your patient and clever help.

    Leave a comment:


  • Maximus
    replied
    1. entity\addLinkMultipleId and entity\removeLinkMultipleId are constant. You don't need to replace the 'entity' word with the name of your entity.
    2. What is 'Leber - verkauft'? in the example the 'teams' it is the name of the related link-multiple field that you can get from the relationship settings. I believe that you have to use 'teams' as it is standard relation embedded by default to all entities.

    So I believe your formula should looks like:
    Code:
    ifThenElse(
        verkauft,
        entity\addLinkMultipleId('teams', '5f05a205c55b648ac'),
        entity\removeLinkMultipleId('teams', '5f05a205c55b648ac')
    );

    Leave a comment:


  • shalmaxb
    replied
    Code:
    ifThenElse(
    verkauft == true,
    ArtCollectionWorks\addLinkMultipleId('Leber - verkauft', '5f05a205c55b648ac'),
    ArtCollectionWorks\removeLinkMultipleId('Leber - verkauft', '5f05a205c55b648ac')
    );ifThenElse(
    verkauft == true,
    ArtCollectionWorks\addLinkMultipleId('Leber - verkauft', '5f05a205c55b648ac'),
    ArtCollectionWorks\removeLinkMultipleId('Leber - verkauft', '5f05a205c55b648ac')
    );
    where ArtCollectionWorks is the entity, where there is the bool field "verkauft"
    where "Leber-verkauft" is one team and "Leber-aktiv" is the other team

    I would like to change , when the bool "verkauft" is checked, the team changes from "Leber-aktiv" to "Leber-verkauft"

    Leave a comment:


  • Maximus
    replied
    shalmaxb I have read your post here https://forum.espocrm.com/forum/gene...0736#post60736. I suggest you to keep posting in this topic as it is your main topic. So here is your post:
    Hi,
    I tried that formula, without success. Perhaps I made some mistakes. I have the team panel on the right side of my main entity. There are 4 teams available, that I would like to change by a bool field in the main entity. If it is true it should unassign from one team and assign to another. If its false it should go back to the first team again.
    In the line, that starts with "entity....", do I have to put the name of my main entity or do I leave the word "entity".
    Do I have to establish first any relationship between team and my main entity? Because it is written here, that I can find the Id and the link name in relationships, what is not the case in my app.
    Appreciate a little help again.
    Please provide your formula.

    Leave a comment:


  • sandra6012
    replied
    Hi, maybe thing

    Hello, I don't know if this can help you.
    I have assigned a team depending on the information of a field and I apply it using the ifThen formula.

    https://forum.espocrm.com/forum/gene...mula-for-teams

    Leave a comment:


  • Maximus
    replied
    In case you want to unassign one team and assign another one you can use the formula described here https://forum.espocrm.com/forum/gene...0001#post60001. Using this way you need to have a status field defined in your Work entity.

    Leave a comment:


  • shalmaxb
    commented on 's reply
    Thank you for the direction. I will see, if I get this. I am not a programmer and sometimes it is hard to follow, when you miss the pre-requisite knowledge.
    Regarding the user and different statuses. It is a bit difficult to explain, because i don`t use ESPOcrm as a plain CRM. I use it for a collection repository of artist`s works, in which the teams are used to categorize, when a work is sold, rent, active or unavailable. In that sold case it is not active anymore, but should stay in the collection. Active is the main "team" and sold is the "team" with sold works.
    So I would like to achieve, that I mark a work in the active "team" as sold (bool) and that would give the condition to relate this work to the sold "team" and breaks the relation to the active team.
    I hope that is understandable. Manually I can do that and it works as desired.

  • Maximus
    replied
    Hi folks.
    Formula doesn't start upon the related entries change and cannot update the related entity record either. I believe that you shalmaxb need to create a Hook https://docs.espocrm.com/development/hooks/.
    Also, I have a question: what if this user is assigned to a few records and all of them would have different statuses?

    Leave a comment:


  • shalmaxb
    replied
    Yes, I tried, but without success so far. But I did not have too much time. I will dive in again later. Any hint welcome.

    Leave a comment:


  • Nishan Perera
    replied
    Hi Sha, Have you tried with formula ?

    Leave a comment:


  • shalmaxb
    replied
    Ok. Thank you. You understood right. Unfortunately workflow is part of the advanced pack, that I do not have.

    Leave a comment:


  • Nishan Perera
    replied
    Hi, yes . This can be done if I correctly understood what you have said. in workflow select Trigger Type and condition. in the action section Update Related Record ยป Assigned User >> field Teams.

    What here I did is account bool is true assigned user team change to support.


    If any development guide needed DM.
    Attached Files

    Leave a comment:


  • shalmaxb
    started a topic Change Team by formula

    Change Team by formula

    Hi,
    is it possible to change the team of an user as effect from changing the status of a bool field? I would like to achieve the change of team for an user, when a certain field is marked true.
Working...
X