Making pre-existing fields mandatory

Discussion in 'Tally Developer' started by torsky, Feb 28, 2023.

    
  1. torsky

    torsky New Member


    I'm trying to make certain pre-existing fields of the ledger mandatory. These include LED Mobile, LEDEMail, LED EmailCC. I'm trying to use the following simple code:

    Code:
    [Field: LED Mobile]
            Skip:No
    I get a TDL error stating "LED Mobile is a duplicate definition already defined in \ledger\ledgerfields/tdl (590)", which is understandable.

    My question is, how can I take control of already defined fields and change certain aspects of them, such as adding Skip:No ?
     


  2. Mahesh Sethi

    Mahesh Sethi Member



    Try This....

    [#Field: LED Mobile]
     
    torsky likes this.


  3. torsky

    torsky New Member


    Thank you Sir, I investigated further and modified as the following code which now works perfect:
    Code:
    [#Field: LED Mobile]
        Valid:  NOT $$IsEmpty:$$Value
    If you may please answer, is there a way to run the above code only when the Ledger Under Type (#MST Parent) is Sundry Debtor or Sundry Creditor? That is to make mobile field mandatory only when creating Sundry Debtor or Creditor ledger type.
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Yes.... use formula...... If parent = $$IsBelongsTo:$$GroupSundryDebtors ............ you can get example from Developer.
     
    torsky likes this.


  5. torsky

    torsky New Member


    Thank you! I was able to improve the code further as follows:
    Code:
    [#Field: LEDEmail]
        Valid:  If ($$IsBelongsTo:$$GroupSundryCreditors) Then NOT $$IsEmpty:$$Value Else True
    I'm now trying to add Skip definition onto the field as
    Code:
    Skip: $$Owner:$$InAlterMode
    to prevent anyone from touching it in alteration mode after the ledger is created. However, it is not working as expected. Any guidance will be very helpful.
     


  6. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Skip : If $$InAltermode Then Yes Else No
     
    naren1234 and torsky like this.


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Or use...$$Owner:$$InAlterMode
     


  8. torsky

    torsky New Member


    Thank you, Sir, for your kind help.

    I've published a small TDL snippet here: https://github.com/physx2494/tally-tdls that has the following function:
    • It makes it mandatory to input the credit period and credit limit
    • Applicable only for ledger type: Sundry debtors and sundry creditors
    • Prevents users from changing the credit period and credit limit in alteration mode thereby preventing bypassing limits manually at the time of generating an invoice
    • Bonus: Mandatory to input client's mobile, phone and email too
     
    Last edited: Mar 6, 2023


  9. Mahesh Sethi

    Mahesh Sethi Member


    Hi,

    Its gives an error when i put ledger under sundry debtors. Screen shoot as under:

    upload_2023-3-6_21-17-22.png
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Disable other TDLs and then try ...........
     


  11. torsky

    torsky New Member


    Works on my end. Enable Credit Control if not.
     


  12. Mahesh Sethi

    Mahesh Sethi Member



    Hi Amit Ji,

    I am trying to implement this on Security Levels name but not success pls guide me.

    Valid : If ($$IsBelongsTo:$CLSName = "Entry") Then NOT $$IsEmpty:$$Value Else True

    Thanks in Advance.

    Mani
     


  13. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Your formula is wrong............ If $udfvalue = "thisvalue" then THIS or THAT .... that is how it goes.

    You cannot use the SYSTEM's funtion---- $$isBelongsto .... without altering the Function definition....... and you cannot alter that Function as it is not part of the OpenSource.
     


  14. Mahesh Sethi

    Mahesh Sethi Member


    Dear Amit Sir,

    I am trying to Mandatory field at user. If user create under security level "Entry" then UDF Field is Mandatory to fill up other wise it is not mandatory to other user who is not under security level "Entry". request to pls give me any example command so that i try it.


    Thanks & Regards,

    Mani
     
    Last edited: Mar 17, 2023


Share This Page