LoginSignup
3
3

More than 5 years have passed since last update.

salesforceのプロファイルメタデータをretrieve・deployする時の注意点

Posted at

備忘 :smile:

例えばこんな感じでアクティブなユーザがいるプロファイル一覧を出して

select id, profile.name from user where isactive = true 

実行結果がこんな感じだったとする

Profile Name
Chatter Free User
Analytics Cloud Integration User
Analytics Cloud Security User
【テスト】システム管理者

package.xmlをこうして

package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Chatter Free User</members>
        <members>Analytics Cloud Integration User</members>
        <members>Analytics Cloud Security User</members>
        <members>【テスト】システム管理者</members>
        <name>Profile</name>
    </types>
    <version>40.0</version>
</Package>

retriveすると

$ jsforce-retrieve -u {username} -p {password} -l https://login.salesforce.com -D ./package/

jsforce/jsforce-metadata-tools

パーセントエンコーディングされるが、取得できる。もちろん中身もちゃんと入ってる

$ tree -N
.
└── package
    ├── package.xml
    └── profiles
        ├── %E3%80%90テスト%E3%80%91システム管理者.profile
        ├── Analytics Cloud Integration User.profile
        ├── Analytics Cloud Security User.profile
        └── Chatter Free User.profile

2 directories, 5 files

で、これを特に何も変更せずにdeployすると

$ jsforce-deploy -u {username} -p {password} -l https://login.salesforce.com -D ./package/
Deploying to server...
Deploy Failed.
Failures:
 - Error on package/package.xml : An object '【テスト】システム管理者' of type Profile was named in package.xml, but was not found in zipped directory

そんなプロファイルはねーぞと怒られる。Nameそのままは取れるけど送れないのね。
package.xmlを.profileのファイル名にするといけた。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3