Announcement

Collapse
No announcement yet.

Learning EspoCRM and Design

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

  • esforim
    replied
    Hi all,

    I think I'm finally on the basic level of formula now. Here one for you to get an idea if you want to implement it yourself. From here I will create many more formula for other thing. What this formula do?

    1) Create a related Meeting and Due Date
    2) If the date change I want the date in the Meeting to be change too
    3) I also want to add a Note so say that it was change. This along with Audit field allow admin to keep track
    4) I assigned my Assigned User to a new user with the id, this user I call it "CRM System" this way I know it was create by my EspoCRM Formula rather than a manual edit from me or someone else.
    5) I think it still a few bug need to get sort, Error 500 but generally it should work.
    6) I only show 1 formula but it pretty much the same, just change as you need it to.
    7) You will need at least 2 new field, or use existing one if you have them.

    Code:
    // Start of Finance meeting creation
    $financeNAME = string\concatenate(ifThenElse(contractDate==financeDate, "CONTRACT IS UNCONDITIONAL - ", '\n', "Finance Due Date - "), caseName);
    
    /// Finance Part
    ifThen (financeDateMeetingID==null && type=='Property', financeDateMeetingID = record\create('Meeting', 'name', $financeNAME, 'dateStart', financeDate, 'parentType', entity\setAttribute('parentType', 'Case'), 'parentId', id, 'assignedUserId', 'id_of_the_assigned_user_go here'));
    ifThen(entity\isAttributeChanged('financeDate'), record\update('Meeting', financeDateMeetingID, 'dateStart', financeDate, 'description', "Finance Date Has Change"));
    
    // END of Finance meeting creation
    How it look:
    Click image for larger version  Name:	image.png Views:	0 Size:	5.9 KB ID:	91828
    Click image for larger version  Name:	image.png Views:	0 Size:	6.1 KB ID:	91829
    Click image for larger version  Name:	image.png Views:	0 Size:	6.0 KB ID:	91830
    Last edited by esforim; 05-04-2023, 06:24 AM.

    Leave a comment:


  • esforim
    commented on 's reply
    I found an app call Tasker and MacroDroid which can do HTTP Request... Hmm I wonder if I can take advantage of this feature to do something. Need to have a think.

    Or if anyone already done something with it, please do share.

  • esforim
    replied
    Be sure to go back to those fail one and "Replay" it, so it will get add to your EspoCRM.

    With spinning top right of the icon are my "replay".
    Click image for larger version

Name:	image.png
Views:	352
Size:	13.8 KB
ID:	90270

    Leave a comment:


  • esforim
    replied
    More success! Manage to resolve the 2nd 'bug'. Convert the new lines to work. I have to create two separate code, if anyone know how I can merge it into one that that help clean up.

    I'll see how it go for few more days and make a 'final' version on my Github (maybe).

    Anyway here is the code use to convert, I kept everything the same from a tutorial I found online, and only change a few thing to make life easier for me to read, as long as it work I don't care about formatting and coding style at the moment.

    Anyway here goes;

    Code:
    export default defineComponent({
      props:{
        description: {
          type: "string",
          label: "Description",
          description: "New lines transform"
          }
      },
        async run({ steps, $ }) {
        const str = this.description;
        const convertedStr = str.replace(/\r?\n/g, '\\n');
        console.log(convertedStr);
        return {EspoDescription: convertedStr}
        },
    })​
    ​
    I guess my next Goal is to add "Contact Name" or search a link to a Parent Contact relation because right now the Android App showing Phone Number Only... Maybe someone can teach me with this because I have a feeling I won't get too far.

    Leave a comment:


  • esforim
    replied
    Originally posted by espcrm View Post
    LEARNING SUMMARY: Add Incoming SMS to EspoCRM Call/Custom Entity
    Hi all,

    I managed to fix the dateStart issue! (I think), need a to wait a see as I slowly hopefully resolve this one by one as I dive into the scary world of Coding.

    Here how I manage to transform the date to a EspoCRM readable format without having validation issue.

    You add this javascript/nodeJS before the Events in Pipedream. I'm starting to like to Pipedream more and more!

    Anyway here is the code and the new Post. Next I need to figure out is how to make 'new lines' \n work because it failing at the moment.

    Javascrip NODE JS
    Code:
    export default defineComponent({
      props:{
        sentStamp: {
          type: "string",
          label: "Start Date",
          description: "Date that it was send"
          }
      },
        async run({ steps, $ }) {
        const unixTimestamp = this.sentStamp; // Example Unix timestamp;
        const date = new Date(unixTimestamp);
        const formattedDate = date.toISOString().replace(/T/, ' ').replace(/\..+/, '');
        console.log(formattedDate);
        return {EspoDate1: formattedDate}
        },
    })​
    HTTP post
    Code:
    {
    "name": "SMS from {{steps.trigger.event.from}}",
    "smsMessage": "{{steps.trigger.event.text}}",
    "phoneNumber": "{{steps.trigger.event.from}}",
    "dateStart": "{{steps.code.$return_value.EspoDate1}}",
    "dateEnd":{{steps.trigger.event.receivedStamp} }
    "type": "SMS",
    "direction": "Inbound",
    "Status": "Held"
    }
    Last edited by esforim; 04-05-2023, 06:17 AM.

    Leave a comment:


  • esforim
    replied
    LEARNING SUMMARY: Add Incoming SMS to EspoCRM Call/Custom Entity

    Hi all,

    Recently discover this App for Android (Free, Open-source project): https://github.com/bogkonstantin/and...ateway_webhook

    What does it do? It forward all your Incoming SMS to a Webhook website through a "POST" request. I'm pretending to know jardon here, anyway it will send your SMS/Text Message on your phone to a website.

    You can either do it for all phone SMS or just a specific numbers, in the tutorial below I will use All phone number since I'm using a Work phone for this purpose.

    In term of setting, after many fail trial and error I figured it out and we can just use the default setting of it. You can trim down the data to save Internet Data...

    Once you download the App and install it will ask for 3 information:
    1) Phone number you want to forward (* for all and any)
    2) Website of the Webhook/Server*. I use Pipedream as my webhook server, I will look in the future where I can self-host a Webhook but for now using this will get me (and whoever reading this) quickly start on this project.
    3) Default data it.

    Pipedream/Webhook server is here: https://pipedream.com
    You can use other webhook server but I can't help you there, I tried a few available and Pipedream seem 'best' at the moment. Once you create a Pipedream Account, just create a new Workflow and choose Trigger as HTTP URL (see screenshot). As for the Action, choose Send any HTTP Request as EspoCRM isn't an available app (yet!).

    Choose Post. Add in your website.
    Add this to your Headers: X-Api-Key as for the hidden key, create a API user for this and copy the API Key. Be sure to give the API User the Role to Assigned User, otherwise you will get a 404.

    I skip some explanation so if you got any question, feel free to ask me.


    Click image for larger version

Name:	image.png
Views:	533
Size:	79.4 KB
ID:	90197

    Leave a comment:


  • jakov
    commented on 's reply
    Sorry telecastg I like to ask you it solution with TextMyMail is still working with you. I can not login to gmail account. i can install app on Android...

  • jakov
    replied
    Sorry telecastg I like to ask you it solution with TextMyMail is still working with you. I can not login to gmail account. i can install app on Android Phone but not login into application. Is there something it must be done on gmail account

    Leave a comment:


  • telecastg
    commented on 's reply
    Sorry, I never got to implement it.

  • jakov
    commented on 's reply
    Like to ask if this app is still running for you at this time. I am tsting last version2.24 but can not login ito Gmail account. It seams like app is installad with all neadet phone system permisions. Can you pleas share some advice.
    Thanks in Advance

  • esforim
    replied
    Thank to shalmaxb for asking this question, allowing me to update a lost feature I wasn't aware of!

    The result is here: https://github.com/o-data/EspoCRM_Mo...r%20RealEstate

    Here is the learning, the learning is below:

    EDIT EDIT: IGNORE EVERYTHING! I figure it out, I didn't see this other 'code' I need to change. This is what happen when you don't code. All seem to be working now! (I think). Just need to try enable on "Upon Update" somewhere now.

    Code:
    class Lead implements WhereBuilder​
    shalmaxb Would you mind looking at my code, I pretty much copy/paste from the documents and change very little but getting a Error 500 file not found for the class. I put my code here:​






    Please note that I tried without the .php and same error. Look like I'm doing something wrong still.

    Reading the documents, not sure which is correct or it dont matter: one Duplicate\WhereBuilder the other DuplicateWhereBuilder

    ​​​

    Interesting, if I change it to Lead it have no issue. So where does this go wrong.

    I change the Filename from Lead.php to Lead1.php, did a test without rebuilding/cache and it will instantly popup "Error 500". So there I just need to figure out this filename issue?

    Log Error:
    [2023-03-22] ERROR: (0) InjectableFactory: Class 'Espo\Custom\Classes\DuplicateWhereBuilders\RealEs tateProperty' does not exist.; POST /RealEstateProperty; line: 114, file: /home/username/domains/website.com/public_html/app/application/Espo/Core/InjectableFactory.php [] []

    I look at this file and don't see anything I can do with it. Is it because I'm doing this for a Custom Entity?​

    Leave a comment:


  • esforim
    replied
    Wow this thread started so long ago:
    01-09-2020

    Anyway I saw a contributor on the 'wiki' and got excited enough to make edit, it should look slightly better but the general concept still the same...
    It doesn't look professional and cool but if you can change it go for it. There is no minimum standard and Quality Control at the moment.

    With all that said, this post is just to say that and hopefully we can recruit more contributor to making edit.
    Last edited by esforim; 03-09-2023, 04:25 AM.

    Leave a comment:


  • esforim
    replied
    Just a quick code, very simple to people get idea that they can use. nameAlt is a custom field which I use to write either their nickname or the true first name. Some people name is out of order due to their legal paperwork.

    Code:
     {{name}} {{#if nameAlt}}(a.k.a. {{nameAlt}}){{/if}}
    My details view
    Click image for larger version  Name:	image.png Views:	0 Size:	25.4 KB ID:	86773

    PDF Print Out
    Click image for larger version  Name:	image.png Views:	0 Size:	9.0 KB ID:	86774

    Leave a comment:


  • esforim
    replied
    Couldn't find where I put this sample code; basically I got a custom Entity I call "Asset", from Asset I link it to Many-Many with Contact. But I only want to filter 2 special asset for one of my PDF Template.

    What Car they Drive and their Bank Account. I achieve this with this code here.

    Code:
    {{#each assets}}{{#ifEqual assetType "Bank Account"}}{{name}}
    BankNumber: {{accountBankNumber}} | Account Number: {{accountNumber}} {{else}} {{/ifEqual}}
    {{/each}}
    {{#each assets}} {{#ifEqual assetType "Car"}}
    {{name}}
    Car: {{assetMainCode}} {{else}} {{/ifEqual}} {{/each}}​
    Last edited by esforim; 01-03-2023, 11:01 PM.

    Leave a comment:


  • esforim
    commented on 's reply
    Are you on Shared Hosting though shalmaxb? We don't have much PHP Cache and RAMs on ours. I'm using Case as my main location so I will see if there is a performance drop that is noticeable as I think of more formula.

    I'm doing more and more calculation recently since I want to move away from Excel for Simple Calculation

    Looking at my Accounting entity, look like it possible for me to create my next goal, "Payslip/Payroll/Paystub" system... but I still need to solve 2 issue which may be possible using "Filter" in the sumrelated formula but need to learn how to use this Filter part.

    Second issue is PDF is still very ugly print, simple template is OK if you just want information but if we want to print for other business they won't be satisfy with 'plain looks'.
    Last edited by esforim; 12-19-2022, 06:49 AM.
Working...
X