* getAllAllowedFieldsForCurrentUser
  * @param objectAPI, Object Api Name
  * @return String.join(fieldList, ','), all the fields concatened, separated by ","
private static string getAllAllowedFieldsForCurrentUser (string objectAPI) {
    return string.join(new List<String>(Schema.getGlobalDescribe().get(objectAPI).getDescribe().fields.getMap().keySet()), ',');
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter