Learning EspoCRM and Design

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • esforim
    commented on 's reply
    Kharg Anyone recommend ratio and how does it fit/stretch?

  • esforim
    replied
    Out of nowhere come more work! A free extension from Mr Kharg.

    Now I have to create some wallpaper

    Custom Login Background Extension for EspoCRM. Contribute to Kharg/custom-login development by creating an account on GitHub.

    Leave a comment:


  • esforim
    commented on 's reply
    You can optimize it like so: https://forum.espocrm.com/forum/gene...3971#post93971

  • esforim
    replied
    I accidentally delete the post so kinda lazy to re-write it now!

    In summary:
    It create a recurring task like system. It semi-auto create the next record for you.
    Special thank to item for secret formula.

    Nothing advanced but the code is hopefully readable and can easily understand what I'm trying to do.
    Formula use many custom field so you need to edit for your usage.

    Very little information is filtered out in this screenshot.

    Result:
    Click image for larger version

Name:	image.png
Views:	627
Size:	32.2 KB
ID:	93955

    Code in screenshot format as copy/paste in here lose the "tab" spacing of formula so harder to read.
    Click image for larger version

Name:	image.png
Views:	417
Size:	60.6 KB
ID:	93956

    And finally the formula code:


    Code:
    ;//////////////////////////////////////////////////////////////////////////
    /// CODE START 5001 - Create a new schedule for the next week.
    ifThen
    (entity\attributeFetched('status')=='Schedule', // Check Attribute and if it equal to
    ifThen
    (status=='Paid' && datePaid!=null, // Only the next action if the following is true.
    record\create
    (
    'Accounting', // Entity type
    'status','Schedule', // Created Record Fieldname and Value
    'name', name,
    'casesIds', casesIds,
    'description', string\concatenate
    (
    '[', 'Previous Payment record \nDate Paid: ', datePaid,
    '\nPayment Amount: $', debit,
    '](#/Accounting/view/', id, ')'
    ),
    'date', datetime\addDays(date, 7), // Create a new field in the future so schedule can be varied. Example: Weekly will input "7"
    'debit', debit,
    'method', method,
    'category', category,
    'assetsAccountToIds', assetsAccountToIds,
    'assetsIds', assetsIds,
    'contactsIds', contactsIds,
    'assignedUserId', assignedUserId,
    'notes', '[This record was auto-generate by (MY ROBOT NAME HERE). Data is prefilled from existing record, confirm and update any changes required.]'
    )
    )
    )
    ////////////////////////////// CODE END 5001 //////////////////////////////​

    Leave a comment:


  • esforim
    replied
    Formula Helper! With v7.5 there is a new formula that can retrieve all data of an record. Very useful for formula creation and debugging, previously I need to go back and forth with field name, and checking current data.

    Now you can just use something like this:

    record\fetch(ENTITY_TYPE, ID)

    Here an example in the Sandbox

    Code:
    output\printLine(
    record\fetch('Contact', '123123-ID-number-here')
    )​

    Leave a comment:


  • esforim
    replied
    A quick formula for the road, hopefully you understand formula now and can understand what is being achieved here. Now with fancy comments.

    Code:
    ;//////////////////////////////////////////////////////////////////////////
    /// CODE START 1003 - Change Status to need more work after Manager/Management QA
    ifThen(
    statusQA=='Minor Defect' && status=='Completed' || statusQA=='Major Defect' && status=='Completed',
    status='Require Update'; statusQA='Re-Check'
    )
    ////////////////////////////// CODE END 1003 //////////////////////////////​

    Leave a comment:


  • esforim
    replied
    Just a quick new formula, this one should work for default instant. Feel free to copy and paste.

    What does it do? Whenever you create a Task from a Case entity, it will copy the Team information assigned in the Case over to the Task. This way, the team will have access to this Task. Previously I keep having to manual add it.

    Furthermore I got smarter and add the ; at the start of the code comments, this way if you have other formula, it still work. But if this is the first Formula then be sure to remove it!

    Code:
    ;/// CODE GUI 1002 - Auto-add Team Grouping when create Task from Case. Need Parent
    ifThen(
    parentType=='Case' && parentId!=null && teamsId==null,
    teamsIds = record\attribute(parentType, parentId, 'teamsIds')
    )
    ////////////////// CODE END​
    parentType need to be case, I want to restrict this to Case entity but you can do anything you want for other entity.
    But I also want to make sure only to do this when the parent is NOT empty !=null
    And that no other team is assigned to that: teamsId==null

    Then I just link it by finding the ID using the record\attribute.

    Leave a comment:


  • esforim
    commented on 's reply
    If you want to search for "Or" you can do the following:

    'industry=' => ['Real Estate', 'Legal']

  • esforim
    replied
    CalDAV CardDAV is finally here: https://docs.dubas.pro/extensions/dav/carddav/

    Time to test it:

    Click image for larger version  Name:	image.png Views:	0 Size:	31.3 KB ID:	93439
    Last edited by esforim; 06-08-2023, 05:32 AM.

    Leave a comment:


  • esforim
    replied
    Finally got around to follow one of the big Boss tutorial for Global Filter: https://www.youtube.com/watch?v=BYllS-6_xdE

    Here is some of my result if anyone want to copy/paste or use as reference.


    --- To Create Global Filter & Search. Edit the following file:

    /custom/Espo/Custom/Classes/Select/CaseObj/PrimaryFilters/*.php
    /custom/Espo/Custom/Resources/metadata/selectDefs/*.json
    /custom/Espo/Custom/Resources/metadata/clientDefs/*.json

    For the php file: AccountRealEstate.php​
    Code:
    <?php
    
    namespace Espo\Custom\Classes\Select\CaseObj\PrimaryFilters;
    
    use Espo\Core\Select\Primary\Filter;
    use Espo\ORM\Query\SelectBuilder;
    
    class AccountRealEstate implements Filter
    {
    public function apply(SelectBuilder $queryBuilder): void
    {
    $queryBuilder->where([
    'industry=' => ['Real Estate']
    ]);
    }
    }​
    For the selectDef Json: Account​.json
    Code:
    {
    "primaryFilterClassNameMap": {
    "Legal": "Espo\\Custom\\Classes\\Select\\CaseObj\\PrimaryFilters\\AccountLegal",
    "Real Estate": "Espo\\Custom\\Classes\\Select\\CaseObj\\PrimaryFilters\\AccountRealEstate"
    }
    }


    for the clientDef json: Account.json

    Code:
    "kanbanViewMode": false,
    "color": "#edc755",
    "iconClass": "fas fa-building",
    "filterList": [
    {
    "name":"Legal",
    "style":"primary"
    },
    {
    "name":"Real Estate",
    "style": "success"
    }
    ],​
    I probably create more filter now that I get the basic of it.

    PS: I skipped his tutorial part for translation as I only use en_US, you might need to add it too maybe if you use other language.

    Leave a comment:


  • esforim
    replied
    Also recently discover this Microsoft software: PowerToy: https://github.com/microsoft/PowerToys

    One of the good feature I like and been using is this:

    Text Extraction (OCR)
    Click image for larger version

Name:	image.png
Views:	486
Size:	18.9 KB
ID:	92978

    And Ruler which I'm using to px measurement in the above post.
    Click image for larger version

Name:	image.png
Views:	472
Size:	14.5 KB
ID:	92979

    Here is some other feature this software have:

    Click image for larger version

Name:	image.png
Views:	462
Size:	28.5 KB
ID:	92980

    Leave a comment:


  • esforim
    replied
    Hi all,

    If you read this you get another tip! Whether it useful or not I don't see feedback so I don't know.

    Recently discover the Layout option for "Width" in px instead of %. Using width is much better for layout especially when it come to Mobile phone view. If you use % it tiny and get cut off. Whereas if you use px you can a much better view in my opinion.

    I don't when this was add but I discover it by accident when I was playing with layout:

    Click image for larger version

Name:	image.png
Views:	494
Size:	13.6 KB
ID:	92975

    Leave a comment:


  • esforim
    replied
    So, now with v7.4 feature where enum field filter down as you type it make sense to add all data!

    For the Address's Autocomplete for City, I finally got around to add all the relevant city in my country. And my Firefox "froze" after I open the setting.

    Naturally I found a online list listing all the City name, and I just need to add the JSON code to do the rest.

    Anyway here the result and copy paste idea if anyone want to do the same.

    1) Get a list of your country/state's City name, preferably in a single line format/CSV/Excel. Here how mine one look:

    Click image for larger version  Name:	image.png Views:	0 Size:	1.5 KB ID:	92603

    2) Now I create formula

    Click image for larger version  Name:	image.png Views:	0 Size:	5.5 KB ID:	92604
    Number 273 is starting number for me as I previously manually add 272 city already. Name is just city name. TextAll is the JSON code I need to add to the following file config.php. Here how I code it:

    Code:
    =CONCATENATE("    ",[@Number]," => '",[@Name],"',")
    Click image for larger version  Name:	image.png Views:	0 Size:	7.2 KB ID:	92607

    File location is here:
    \app\data\config.php

    Search for the code and add the above.
    Click image for larger version  Name:	image.png Views:	0 Size:	1.3 KB ID:	92605
    Make sure there is no , comma at the last city
    Click image for larger version  Name:	image.png Views:	0 Size:	1.5 KB ID:	92606

    Leave a comment:


  • esforim
    replied
    Hi all,

    Do you use Sandbox Formula? Do you get an error?! After playing with it enough I found one something, here is learning below, hopefully the Helper is more clearer in the future... so I'm too ignorant.

    Well one trick to using the formula is like this below, you can't put an outputprint at the start and end.

    Let For example:

    You want to run this code:


    Code:
    if (fromAddress=="abc@email.com"){
    name
    }​
    Then you want to see the output of it.

    Code:
    output\print(
    if (fromAddress=="abc@email.com"){
    name
    }​
    )
    You will get an error! You need to do it like this:

    Code:
    if (fromAddress=="abc@email.com"){
    output\print(
    name
    )
    }​


    And if you want variable, it outside as well.

    Code:
    $coolAttribute = string\concatenate(name, name) ;
    
    if (fromAddress=="abc@email.com"){
    output\print(
    $coolAttribute
    )
    }​
    ​​

    PS: I add paragraph so it easier to read/see in the code.

    Leave a comment:


  • esforim
    replied
    Hi all,

    Another formula for the road. It purpose is to auto fill missing or unknown Postal Code!

    It should work for all entity I think... one can only hope as I use it and test it. Anyway here it is:

    1) Require: Real Estate extension or create one or own. It free so just use it!
    2) For the field Type, I use a new Option call "City" so it only filter the city instead of searching for bunch of address.
    3) All field name should be default.

    Code:
    ifThen(addressPostalCode==null, // if the Post Code is blank (null)
    addressPostalCode= record\attribute('RealEstateProperty', // then write Post code for me by finding the "data" (attribute) from my RealEstateProperty entity name
    record\findOne('RealEstateProperty', 'addressPostalCode', 'asc', 'type=', 'City', 'addressCity=', addressCity),  // Search for it by using findOne and it will return an ID, search it by find the type to be City only, and the City name is the same.
    'addressPostalCode')​ //  write in data in my field postcode.

    Leave a comment:

Working...