Tag: Development

  • Salesforce: Trigger on Attachment – Restricting user from attaching files with specific extensions

    By default, Salesforce doesn’t allow admin to configure or restrict a user from adding a specific type of files. Admin may need that user should not be able to attach files of type exe, dll which can have the virus in them. Also, there is no virus check is done when a file is getting…

  • Creating multiple tabs for same Salesforce Object

    Many time I have seen Salesforce Admins wants multiple tabs for same object depending upon the RecordTypes or some other criteria like separate tabs for Premium Account, Gold Accounts and Silver. Indeed they can create multiple views and use the picklist and use “Go” button. But it has disadvantage like multiple clicks, not that user…

  • Salesforce: SF:INVALID_SESSION_ID

    I was constantly getting exception when I tried to use the “/soap/ajax/15.0/connection.js” in the VF Page. JavaScript throws following exception:- {faultcode:’sf:INVALID_SESSION_ID’, faultstring:’INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session’, detail:{UnexpectedErrorFault:{exceptionCode:’INVALID_SESSION_ID’, exceptionMessage:’Invalid Session ID found in SessionHeader: Illegal Session’, }, }, } The exception was resolved when I added following statement before using the “sforce.connection”…

  • C# : Converting DateTime to format YYYY-MM-DDThh:mm:ssZ

    I found that lots of people were searching to convert the datetime into the universal format. Following can be used for the same. myDateTime.ToString(“u”) OR string strDate = DateTime.UtcNow.ToString(“yyyy’-‘MM’-‘dd’T’HH’:’mm’:’ss’Z’”, DateTimeFormatInfo.InvariantInfo); The custom format string is “yyyy’-‘MM’-‘dd HH’:’mm’:’ss’Z’”.

  • Regex for AlphaNumeric password validation

    Regular Expression for validating the string (?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,20})$ The above RegEx requires at least one digit, at least one alphabetic character, no special characters, and from 8-20 characters in length.

  • Accessing System information through Environment in C#

    The Environment List When a program is executed, it is also passed a list of current environmental variables (such as HOME, PATH etc). This is the same in both Unix and Windows. The following code example shows how a call to Environment.GetEnvironmentVariables returns all the currently defined variables. The following code explores the various members…