amtrack / sfdx-plugin-source-read

sfdx plugin to read Metadata via CRUD Metadata API
37 stars 4 forks source link

Custom Profiles Not Working? #54

Closed satishpersonal closed 1 year ago

satishpersonal commented 1 year ago

Hi ,

I'm trying to use the Plugin and it works for Standard Profiles. But Custom profile it shows a empty xml File.

amtrack commented 1 year ago

@satishpersonal I'm not aware of any issues with custom Profiles.

satishpersonal commented 1 year ago

@amtrack

I have used below commands and below is what happening in my sandbox.

sfdx force:source:read -m "Profile:Admin" --> When i execute this command the System Admin profile is retrieved properly and metadata file is created with all permissions

For Custom One's sfdx force:source:read -m "Profile:BC Sourcing" --> When i execute this command it creates a file but no permissions were written in the file not even user/system permissions.

Not sure if i understood it wrongly or what's going wrong. Also i tried with Standard Platform user profile then also it worked properly.

amtrack commented 1 year ago

@satishpersonal I don't really have an idea what could be wrong.

Does sfdx force:source:retrieve -m "Profile:My Custom Profile" work?

satishpersonal commented 1 year ago

hi @amtrack ,

but then it only retrieves or based on my package.xml i'm looking for the plugin help to retrieve the full profile metadata.

image

amtrack commented 1 year ago

@satishpersonal Yes, I just wanted to know if the retrieve command works (a.k.a executes successfully) with this custom profile or if it fails (because the profile name is incorrect for example).

amtrack commented 1 year ago

@amtrack some more info on this issue. I had the same issue when I was connected to a non sandbox environment. Standard profiles worked but I got an empty file when trying to retrieve a custom profile. I was able to retrieve both profiles when I connected to a sandbox environment. Hope this helps!

@rcormier13 I tried with a Scratch Org, Sandbox, Production and Developer Edition, but couldn't reproduce it.

If you can share a reproduction of this issue, this would be great.

rcormier13 commented 1 year ago

@amtrack yeah, I removed my comment because I realized it was not true. I don't know, I got the same issue, empty xml for custom profiles on an environment, then tried a sandbox which worked but later on I retried the first environment and it worked. So maybe I had a typo in the name even though I'm pretty sure it was fine. What I learned is that we need to use the profile FullName which is only visible in Developer console when running the Tooling API. I was trying to extract the System Administrator profile and it was returning empty because we needed to get the "Admin" profile and not the "System Administrator". Otherwise it works well, really helpful for profiles!