Skip to content

Instantly share code, notes, and snippets.

@joerodgers
Created October 14, 2025 15:13
Show Gist options
  • Select an option

  • Save joerodgers/3462db5228cf7bb4d6ce4916ce4ab1f7 to your computer and use it in GitHub Desktop.

Select an option

Save joerodgers/3462db5228cf7bb4d6ce4916ce4ab1f7 to your computer and use it in GitHub Desktop.
Example Copilot Studio Topic showing how to cache User Profile properties in a global record variable for 24 hours
kind: AdaptiveDialog
beginDialog:
kind: OnActivity
id: main
condition: =DateDiff(DateAdd(Coalesce(Global.UserProfile.LastRefreshed,Now()), 1440, TimeUnit.Minutes), Now(),TimeUnit.Minutes) > 0
type: Message
actions:
- kind: BeginDialog
id: 0FnaSJ
input: {}
dialog: crc1f_userProfilePropertyAgent.action.Office365Users-GetuserprofileV2
output:
binding:
aboutMe: Topic.aboutMe
accountEnabled: Topic.accountEnabled
birthday: Topic.birthday
businessPhones: Topic.businessPhones
city: Topic.city
companyName: Topic.companyName
country: Topic.country
department: Topic.department
displayName: Topic.displayName
givenName: Topic.givenName
hireDate: Topic.hireDate
id: Topic.id
interests: Topic.interests
jobTitle: Topic.jobTitle
mail: Topic.mail
mailNickname: Topic.mailNickname
mobilePhone: Topic.mobilePhone
mySite: Topic.mySite
officeLocation: Topic.officeLocation
pastProjects: Topic.pastProjects
postalCode: Topic.postalCode
preferredLanguage: Topic.preferredLanguage
preferredName: Topic.preferredName
responsibilities: Topic.responsibilities
schools: Topic.schools
skills: Topic.skills
state: Topic.state
streetAddress: Topic.streetAddress
surname: Topic.surname
userPrincipalName: Topic.userPrincipalName
userType: Topic.userType
- kind: SetVariable
id: setVariable_TcTVYK
variable: Global.UserProfile
value: |-
={
City : Coalesce(Topic.city, "UKNOWN"),
Country: Topic.country,
UserPrincipalName : Topic.userPrincipalName,
LastRefreshed: Now()
}
- kind: ConditionGroup
id: conditionGroup_EIVFzh
conditions:
- id: conditionItem_1UYxcB
condition: =System.Conversation.InTestMode = true
actions:
- kind: SendActivity
id: sendActivity_afJPea
activity: "InTestMode: USER PROFILE CACHE REFRESHED"
inputType: {}
outputType: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment