Salesforce -- 代码控制记录共享
来源:互联网 发布:环境污染数据表格 编辑:程序博客网 时间:2024/06/03 05:36
JS:
var objSharing = new sforce.SObject("objname__share");//here you have to supply the name of the sharing object corresponding to that object for which you want to share the record. objSharing.ParentId = objectId;//which you are getting in javascript.objSharing.AccessLevel = 'Read';objSharing.UserOrGroupId = userId;//to whom you have to share the recordvar result = sforce.connection.create([objSharing]);
Apex:
// Create a new Job__Share record to be inserted in to the Job_Share table. Job__Share hiringManagerShare = new Job__Share(); // Populate the Job__Share record with the ID of the record to be shared. hiringManagerShare.ParentId = job.Id; // Then, set the ID of user or group being granted access. In this case, // we’re setting the Id of the Hiring Manager that was specified by // the Recruiter in the Hiring_Manager__c lookup field on the Job record. // (See Image 1 to review the Job object's schema.) hiringManagerShare.UserOrGroupId = job.Hiring_Manager__c; // Specify that the Hiring Manager should have edit access for // this particular Job record. hiringManagerShare.AccessLevel = 'edit'; // Specify that the reason the Hiring Manager can edit the record is // because he’s the Hiring Manager. // (Hiring_Manager_Access__c is the Apex Sharing Reason that we defined earlier.) hiringManagerShare.RowCause = Schema.Job__Share.RowCause.Hiring_Manager_Access__c; // Add the new Share record to the list of new Share records. jobShares.add(hiringManagerShare); //后面插入集合/单个记录
业务机会共享:
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunityshare.htm
阅读全文
0 0
- Salesforce -- 代码控制记录共享
- salesforce 权限控制
- Salesforce 常用代码
- salesforce----------权限控制(详解1)
- SalesForce
- SalesForce
- SalesForce
- Salesforce
- Salesforce
- 怎样用代码控制DataGridView的记录移?
- 水晶报表 代码控制记录排序专家
- Salesforce-在代码调用审批流
- salesforce 中 profiles 和 roles 权限控制区别
- salesforce 访问权限控制以及和java的区别
- [salesforce]用APEX Code来控制transaction And Rollback
- 共享Binding共享代码
- Salesforce开发工具之Metaforce - 同步/编辑代码
- salesforce中自定义button执行js调用后台apex代码
- xml文件--DOM4J方式解析xml文件
- windows10下使用gyp编译google_breakpad
- 演讲主题更新:12月9号下午深圳Linuxer聚会下午茶交流
- 线段树学习
- 成绩排序
- Salesforce -- 代码控制记录共享
- OpenCV--形态学操作
- 指针编程错误
- view视图解析器解析
- 登录页面(含后台)login.php
- np.random.randint and random.randint
- hdu 1907 John
- Linux(CentOs) 基础命令收集
- 简易迷宫的实现