2017年2月24日 星期五

Get role hierarchy in SOQL query

Get role hierarchy in SOQL query


01private static Set<ID> getAllSubRoleIds(Set<ID> roleIds) {
02
03    Set<ID> currentRoleIds = new Set<ID>();
04
05    // get all of the roles underneath the passed roles
06    for(UserRole userRole :[select Id from UserRole where ParentRoleId
07         IN :roleIds AND ParentRoleID != null]) {
08        currentRoleIds.add(userRole.Id);
09    }
10
11    // go fetch some more rolls!
12    if(currentRoleIds.size() > 0) {
13        currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds));
14    }
15
16    return currentRoleIds;
17}


參考網址:https://developer.salesforce.com/forums/?id=906F0000000DCTFIA4


2017年2月8日 星期三

使用JavaScript讀取檔案

    <html>
    <head>
    <script>
      var openFile = function(event) {
        var input = event.target;

        var reader = new FileReader();
        reader.onload = function(){
          var text = reader.result;
          var node = document.getElementById('output');
          node.innerText = text;
          console.log(reader.result.substring(0, 200));
        };
        reader.readAsText(input.files[0]);
      };
    </script>
    </head>
    <body>
    <input type='file' accept='text/plain' onchange='openFile(event)'><br>
    <div id='output'>
    ...
    </div>
    </body>
    </html>

參考網址:http://stackoverflow.com/questions/14446447/javascript-read-local-text-file

2017年1月16日 星期一

限制Html Input只能輸入數字


<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
</input>
參考網址

比對程式碼不同 DiffNow

比對程式碼用線上網站:
https://www.diffnow.com/