This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ParentId FROM FieldPermissions WHERE | |
Field = 'CustomObject__c.CustomField__c' | |
AND SObjectType = 'CustomObject__c' | |
AND PermissionsRead = true | |
AND ParentId IN (SELECT PermissionSetId from PermissionSetAssignment WHERE AssigneeId = '005USerID0000AAA') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MD { | |
public static String buildPackageXMLForMD(SObjectType mdt, String whereClause){ | |
String mdtName = [ select DeveloperName FROM EntityDefinition where QualifiedAPIName = :mdt.getDescribe().getName() ].DeveloperName; | |
List<SObject> records = Database.query('SELECT DeveloperName FROM ' + mdt + whereClause ); | |
List<String> items = new List<String>(); | |
for (SObject r: records) { | |
items.add( mdtName + '.' + r.get( 'DeveloperName' ) ); | |
} | |
return ' <types>\r\n <members>' + String.join( items, '</members>\r\n <members>' ) + '</members>\r\n <name>CustomMetadata</name>\r\n </types>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String buildPackageXMLForMD(SObjectType mdt){ | |
String mdtName = mdt.getDescribe().getName(); | |
List<SObject> records = Database.query('SELECT DeveloperName FROM ' + mdt ); | |
List<String> items = new List<String>(); | |
for (SObject r: records) { | |
items.add( mdtName + '.' + r.get( 'DeveloperName' ) ); | |
} | |
return ' <types>\r\n <members>' + String.join( items, '</members>\r\n <members>' ) + '</members>\r\n <name>CustomMetadata</name>\r\n </types>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MD.updateAndDeployMetadata( | |
[ SELECT Field1__c, Field2__c, Field3__c, Field4__c FROM Object__c ], | |
CustomMetadata__mdt.sObjectType, | |
new Map<SObjectField, SObjectField>{ | |
Object__c.Field1__c=> CustomMetadata__mdt.Field1__c, | |
Object__c.Field2__c=> CustomMetadata__mdt.Field2__c, | |
Object__c.Field3__c=> CustomMetadata__mdt.Field3__c, | |
Object__c.Field4__c => CustomMetadata__mdt.Field4__c | |
}, | |
'X+Field1__c+_+Field2__c', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MD { | |
public static List<String> getItems(List<String> parts, Map<String, Schema.SObjectField> fieldsMap, SObject r) { | |
List<String> items = new List<String>(); | |
for (String part: parts) { | |
items.add( fieldsMap.containsKey( part ) ? String.valueOf( r.get( part ) ) : part ); | |
} | |
return items; | |
} | |
public static Id updateAndDeployMetadata(List<SObject> sourceRecords, SObjectType dest, Map<SObjectField, SObjectField> mappings, String fullNameDef, String labelDef) { | |
Metadata.DeployContainer mdContainer = new Metadata.DeployContainer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmptyValueFilter implements IFilter { | |
SObjectField field; | |
public EmptyValueFilter(SObjectField f) { | |
field = f; | |
} | |
public Boolean check(SObject rec, SObject old) { | |
return rec.get(field) == null | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- <pre> | |
public class URLService { | |
@auraEnabled | |
public static String getBaseURL() { | |
PageReference pr = new PageReference('/id/' + UserInfo.getOrganizationId() + '/' + UserInfo.getUserId() + '?oauth_token=' + UserInfo.getSessionId() ); | |
System.debug(LoggingLevel.ERROR, '@@@ v: ' + pr.getContent().toString() ); | |
String data = pr.getContent().toString(); | |
Map result = (Map)Json.deserializeUntyped(data); | |
Map urls = (Map)result.get('urls'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, copy; | |
def solve(n,v): | |
parni = [] | |
neparni = [] | |
for i in range(n): | |
if i % 2 == 0: | |
parni.append(v[i]) | |
else: | |
neparni.append(v[i]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 | |
1 CS | |
2 CS | |
1 SS | |
6 SCCSSC | |
2 CC | |
3 CSCSS | |
10000000 CCCCCCCCCCCCCCCCCCCCSSSSSSSSSS | |
536870911 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCS | |
268435455 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, copy; | |
def modify(a, i, z, d): | |
x = a[i] | |
y = x['v'] | |
m = z['m'] | |
damage = z['d'] | |
print "y=", y | |
while (y > 0): | |
x['v'] -= 1 | |
a[i-1]['v'] += 1 |
NewerOlder