• Thomas Gagné
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
I've converted my standard mdapi directory using the script below:
sfdx force:project:create --projectname dx-maintenance
cd dx-maintenance/
time sfdx force:mdapi:convert -r ../fsb-maintenance/src
mkdir manifest
cp ~/git/fsb-maintenance/src/package.xml manifest/
time sfdx force:source:deploy -x manifest/package.xml -u gagne
But that command complains at the end:
ERROR:  The CustomLabel named API_Only_Profile_Id was not found in the workspace.

I confirmed the CustomLabel file exists
DrozBook:dx-maintenance tgagne$ ls -l force-app/main/default/labels/CustomLabels.labels-meta.xml 
-rw-r--r--  1 tgagne  staff  298376 Nov  4 00:19 force-app/main/default/labels/CustomLabels.labels-meta.xml
And that API_Only_Profile_Id is the /first/ label inside it:
<labels>
    <fullName>API_Only_Profile_Id</fullName>
    <categories>Id, Profile</categories>
    <language>en_US</language>
    <protected>false</protected>
    <shortDescription>API Only Profile Id</shortDescription>
    <value>00eG0000000eeBC</value>
</labels>



And package.xml contains what you'd expect.
<types>
    <members>API_Only_Profile_Id</members>
    ...
    <name>CustomLabel</name>
</types>
So what else does sfdx force:soure:deploy need to work?  What am I missing?
I've converted my standard mdapi directory using the script below:
sfdx force:project:create --projectname dx-maintenance
cd dx-maintenance/
time sfdx force:mdapi:convert -r ../fsb-maintenance/src
mkdir manifest
cp ~/git/fsb-maintenance/src/package.xml manifest/
time sfdx force:source:deploy -x manifest/package.xml -u gagne
But that command complains at the end:
ERROR:  The CustomLabel named API_Only_Profile_Id was not found in the workspace.

I confirmed the CustomLabel file exists
DrozBook:dx-maintenance tgagne$ ls -l force-app/main/default/labels/CustomLabels.labels-meta.xml 
-rw-r--r--  1 tgagne  staff  298376 Nov  4 00:19 force-app/main/default/labels/CustomLabels.labels-meta.xml
And that API_Only_Profile_Id is the /first/ label inside it:
<labels>
    <fullName>API_Only_Profile_Id</fullName>
    <categories>Id, Profile</categories>
    <language>en_US</language>
    <protected>false</protected>
    <shortDescription>API Only Profile Id</shortDescription>
    <value>00eG0000000eeBC</value>
</labels>



And package.xml contains what you'd expect.
<types>
    <members>API_Only_Profile_Id</members>
    ...
    <name>CustomLabel</name>
</types>
So what else does sfdx force:soure:deploy need to work?  What am I missing?
I've converted my standard mdapi directory using the script below:
sfdx force:project:create --projectname dx-maintenance
cd dx-maintenance/
time sfdx force:mdapi:convert -r ../fsb-maintenance/src
mkdir manifest
cp ~/git/fsb-maintenance/src/package.xml manifest/
time sfdx force:source:deploy -x manifest/package.xml -u gagne
But that command complains at the end:
ERROR:  The CustomLabel named API_Only_Profile_Id was not found in the workspace.

I confirmed the CustomLabel file exists
DrozBook:dx-maintenance tgagne$ ls -l force-app/main/default/labels/CustomLabels.labels-meta.xml 
-rw-r--r--  1 tgagne  staff  298376 Nov  4 00:19 force-app/main/default/labels/CustomLabels.labels-meta.xml
And that API_Only_Profile_Id is the /first/ label inside it:
<labels>
    <fullName>API_Only_Profile_Id</fullName>
    <categories>Id, Profile</categories>
    <language>en_US</language>
    <protected>false</protected>
    <shortDescription>API Only Profile Id</shortDescription>
    <value>00eG0000000eeBC</value>
</labels>



And package.xml contains what you'd expect.
<types>
    <members>API_Only_Profile_Id</members>
    ...
    <name>CustomLabel</name>
</types>
So what else does sfdx force:soure:deploy need to work?  What am I missing?
We have identified an issue where Cache.Session get() method does NOT return data stored in cache intermittently. We have put together a very tiny sample VisualForce page to demonstrate the problem. This sample page demonstrates that Cache.Session.getPartition(partitionName).get(KEY) returns NULL even if the data exists in cache for the given KEY. The page performs 100 Visualforce.remoting.Manager.invokeAction calls to a controller remote action. If the Apex code is not able to retrieve the data from cache it returns "Not Found" otherwise it returns "Found". Case # created with Salesforce.com 14311948.

See code and output sample below:

VisualForce Page:
<apex:page controller="CacheTestController" showChat="false" showHeader="false">

<div style="margin: 10px; font-size: 14px">
    <pre id="put">In progress ...</pre>
    <pre id="get"></pre>
</div>
 
<script>
    Visualforce.remoting.Manager.invokeAction(
        'CacheTestController.putCache', function(result, event) {
            document.getElementById('put').innerHTML = result;
        }, 
        { escape: false }
    );
 
    var tentative = 1;
 
    var timer = setInterval(function () {
 
        if (tentative == 100) clearInterval(timer);
 
        Visualforce.remoting.Manager.invokeAction(
            'CacheTestController.getCache', tentative, function (result, event) {
                document.getElementById('get').innerHTML += result + '<br/>';
            }, 
            { escape: false }
        );
 
        tentative++;
 
    }, 1000);
</script>
</apex:page>



Controller:
public class CacheTestController {
 
    private static final String PARTITION_NAME = 'FinancialServices';
    private static final String KEY = 'STAGE';
    private static final String VALUE = 'Any value';
      
    @RemoteAction
    public static String putCache() {
 
        Cache.Partition partition = Cache.Session.getPartition(PARTITION_NAME);
 
        partition.put(KEY, VALUE);
 
        return 'ok';
    }
 
    @RemoteAction
    public static String getCache(String tentative) {
 
        String found = 'Found: ' + tentative;
 
        Cache.Partition partition = Cache.Session.getPartition(PARTITION_NAME);
       
        String cacheValue = (String) partition.get(KEY);
       
        if (cacheValue == null) {
            found = 'Not Found: ' + tentative;
        }
       
        return found;
    }
}

Output:
Found: 1
Found: 2
Found: 3
Found: 4
Found: 5
Found: 6
Found: 7
Found: 8
Found: 9
Found: 10
Found: 11
Found: 12
Found: 13
Found: 14
Found: 15
Not Found: 16
Found: 17
Found: 18
Found: 19
Found: 20
Found: 21
Found: 22
Not Found: 23
Found: 24
Found: 25
Found: 26
Found: 27
Found: 28
Not Found: 29
Not Found: 30
Found: 31
Found: 32
Found: 33
Found: 34
Found: 35
Found: 36
Found: 37
Found: 38
Found: 39
Found: 40
Found: 41
Found: 42
Found: 43
Not Found: 44
Found: 45
Not Found: 46
Found: 47
Found: 48
Found: 49
Found: 50
Found: 51
Found: 52
Found: 53
Found: 54
Not Found: 55
Found: 56
Found: 57
Found: 58
Found: 59
Found: 60
Found: 61
Found: 62
Found: 63
Not Found: 64
Found: 65
Found: 66
Found: 67
Found: 68
Found: 69
Found: 70
Found: 71
Found: 72
Not Found: 73
Found: 74
Found: 75
Found: 76
Found: 77
Not Found: 78
Found: 79
Found: 80
Found: 81
Found: 82
Found: 83
Not Found: 84
Found: 85
Found: 86
Found: 87
Found: 88
Found: 89
Found: 90
Found: 91
Found: 92
Found: 93
Found: 94
Found: 95
Not Found: 96
Found: 97
Found: 98
Found: 99
Found: 100

 

I want to use record Type to limit trigger action. 

 

Now I use querey to get it my code liks below

string Id = [SELECT id from RecordType where Name ='Someone'].Id;

 

I also found this page, we could use method to get the Record Type Id to avoid the query.

I still can't understand it.

 

Is there some simple and easy wayt to get the ID only by Record Type's Name?